Jun 17, 2010

iPhone 4 BLACK wearing Bumpers

Did you order iPhone 4? I ordered a black model. And I want to get Bumpers for iPhone 4. Writing Bumpers, Apple show us only white model wearing them. I couldn't have imagined the black model with Bumpers. So, I asked a designer to create the image. He created this.





You can see the large image here.

http://www.ariesplus.com/wordp/iphone/407.html

Which color do you like?

Jun 14, 2010

Use JavaScript-like "with" syntax in Ruby

JavaScript has "with" syntax. At first, I write a code without "with".

  1. console.log(Math.cos(1/2)); //=> 0.8775825618903728  
  2. console.log(Math.sqrt(2)); //=> 1.4142135623730951  



Then, I write with "with".

  1. with(Math) {  
  2.   console.log(cos(1/2)); //=> 0.8775825618903728  
  3.   console.log(sqrt(2)); //=> 1.4142135623730951  
  4. }  



On the other hand, Ruby has not "with" syntax.

  1. puts Math.cos(1/2) #=> 1.0  
  2. puts Math.sqrt(2) #=> 1.4142135623731  



Look! I can use "with" in Ruby!

  1. with(Math) {  
  2.   puts cos(1/2) #=> 1.0  
  3.   puts sqrt(2) #=> 1.4142135623731  
  4. }  



To do this, I wrote "with" function.

  1. def with(obj, &block)  
  2.   obj.instance_eval(&block)  
  3. end  



So, I can use "with" syntax.

  1. with(Math) {  
  2.   puts cos(1/2) #=> 1.0  
  3.   puts sqrt(2) #=> 1.4142135623731  
  4. }  



Of course, other type of object is OK. String, Intger and so on.

  1. with("I love Ruby.") {  
  2.   puts reverse #=> .ybuR evol I  
  3.   puts gsub(/Ruby/, "YUI"#=> I love YUI.  
  4. }  


  1. with(1) {  
  2.   puts succ #=> 2  
  3. }  

Jun 13, 2010

To buy, or not to buy: that is the question.

Pre-order of iPhone 4 start from the day after tomorrow in Japan. I can't make up my mind to buy. I bought Kindle DX two month ago and iPad last month. So I used a lot of money. As a developer, the high-resolution should be noted.


By the way, which is better, white or black? I thought iPhone should be black. But the white model is cool as for iPhone 4. Black or white: that is the question.