This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired by the protovis library pv.Scale.linear().range() | |
# adapted from rspec codebase | |
def let(name, scale_function) | |
Kernel.send :define_method, name do |p| | |
scale_function.call(p) | |
end | |
end | |
# returns a mapping function from the desired domain (x1,x2) to the desired range (y1,y2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<foo> | |
<bar @mike="hi"> | |
<ug>what</ug> | |
<ug>who</ug> | |
</bar> | |
</foo> | |
> foo.bar.mike # = "hi" | |
> foo.bar.ug # = ["what", "who] | |
> foo.bar.ug[0] # = "what" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testing rakefile | |
task :default do | |
sh('exit 1') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def hexbytes | |
self.bytes.to_a.map {|c| c.to_s(16).upcase}.join | |
end | |
def hexchars | |
self.chars.to_a.map {|c| c.hexbytes} | |
end | |
def unicodechars |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ "keys": ["f8"], "command": "p4_edit" } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" }, | |
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Win7 Powershell script to resize Minecraft to 1280x720 (HD for fraps youtube capture) | |
# use by typing the following at a command prompt: | |
# > PowerShell -ExecutionPolicy Bypass -File minecraft-sethd.ps1 | |
# refs: | |
# http://stackoverflow.com/questions/2556872/how-to-set-foreground-window-from-powershell-event-subscriber-action | |
# http://richardspowershellblog.wordpress.com/2011/07/23/moving-windows/ | |
# http://www.suite101.com/content/client-area-size-with-movewindow-a17846 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I use pushd and popd to maintain a directory stack and so I like being able to navigate | |
# around the stack with the cursor keys. Here's how: | |
# 1) pushd <new dir> | |
# 2) use CTRL+UP, CTRL+LEFT or CTRL+RIGHT as follows: | |
# bind ctrl + cursor keys: | |
# left = prev; right = next; up = list | |
bind '"\e[1;5A":"dirs\C-m"' | |
bind '"\e[1;5D":"pushd -0 2>/dev/null\C-m"' | |
bind '"\e[1;5C":"pushd +1 2>/dev/null\C-m"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
ruby-1.9.2-p180 :001 > "“" | |
=> "“" | |
ruby-1.9.2-p180 :002 > "“".encoding | |
=> #<Encoding:UTF-8> | |
ruby-1.9.2-p180 :003 > "\“" | |
SyntaxError: (irb):7: invalid multibyte char (UTF-8) | |
(irb):7: invalid multibyte char (UTF-8) | |
from /local/rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }, | |
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} } |
OlderNewer