Posts tagged: howto

HOWTO Disable tap-to-click in Ubuntu

Open Terminal window and type:

sudo gpointing-device-settings

Then on General tab click “Disable tapping and scrolling”

HOWTO Escape a Unicode string with Ruby

From: http://stackoverflow.com/questions/5560914/how-do-i-escape-a-unicode-string-with-ruby

Ruby 1.8.x:

1
2
3
4
5
6
7
8
9
>> multi_byte_str = "hello\330\271!"
=> "hello\330\271!"

>> multi_byte_str.inspect
=> "\"hello\\330\\271!\""

>> puts multi_byte_str.inspect
"hello\330\271!"
=> nil

Ruby 1.9

1
2
>> multi_byte_str.bytes.to_a.map(&:chr).join.inspect
=> "\"hello\\xD8\\xB9!\""

Ruby 1.8 and 1.9 – Unicode code points

1
2
>> multi_byte_str.unpack('U*').map{ |i| "\\u" + i.to_s(16).rjust(4, '0') }.join
=> "\\u0068\\u0065\\u006c\\u006c\\u006f\\u0639\\u0021"

WordPress Themes