I hereby claim:
- I am rwtnorton on github.
- I am rwtnorton (https://keybase.io/rwtnorton) on keybase.
- I have a public key whose fingerprint is F865 C3B6 48B5 DCD9 96E7 A6AA 09A8 F41D 2A1E 5EE9
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # bash function | |
| defcomp () { | |
| local name="$1" && shift | |
| local functionName="$( echo "${name}_completion" | tr - _ )" | |
| source <(cat <<EOM | |
| $functionName () { | |
| local cur | |
| _get_comp_words_by_ref -n =: cur | |
| COMPREPLY=( \$(compgen -W "\$( $@ )" -- "\$cur") ) | |
| } |
| #!/bin/bash | |
| ## | |
| ## Updates all environment.rb files on your box to use your | |
| ## email address. Prevents spamming everyone on test@shops.com. | |
| ## | |
| ## *** Just remember to not commit the edit to master!!! *** | |
| ## | |
| ## | |
| ## INSTALL |
| #!/usr/bin/env ruby | |
| # Changes hashrockets (i.e., `:foo => 1`) to 1.9 syntax (i.e., `foo: 1`). | |
| while line = gets do | |
| line.chomp if line | |
| line.gsub!(/:(\w+)\s*=>\s*/, "#{$1}: ") | |
| puts line | |
| end | |
| # cat|ruby -ple '$_.gsub!(/:(\w+)\s*=>\s*/, "#{$1}: ")' |
| #!/bin/sh | |
| # Changes hashrockets (i.e., `:foo => 1`) to 1.9 syntax (i.e., `foo: 1`). | |
| cat |ruby -ple '$_.gsub!(/:(\w+)\s*=>\s*/, "#{$1}: ")' |
| #!/bin/sh | |
| # Changes hashrockets (i.e., `:foo => 1`) to 1.9 syntax (i.e., `foo: 1`). | |
| cat |perl -ple 's/:(\w+)\s*=>\s*/$1: /g' |
| #!/usr/bin/env ruby | |
| require 'json' | |
| require 'open-uri' | |
| open('http://api.icndb.com/jokes/random') do |f| | |
| f.each_line do |s| | |
| json = JSON.load(s) | |
| if json && json['value'] && json['value']['joke'] | |
| puts json['value']['joke'] | |
| end | |
| end |
| #!/bin/bash | |
| queue="resque:queue:notifications" | |
| # Replace with location pertinent to your setup. | |
| cd ~/src/digistore_new/administrators | |
| had=`redis-cli llen $queue |sed 's/\([0-9]\+\)/$1/'` | |
| # TODO: There must be a way to do this in one operation. |
| 1.9.3p0 :001 > class Object; def in?(enum); enum.respond_to?(:include?) ? enum.include?(self) : false; end; end | |
| => nil | |
| 1.9.3p0 :002 > 1.in? ['a', 2, Time.now] | |
| => false | |
| 1.9.3p0 :003 > 1.in? ['a', 2, Time.now, nil, 1] | |
| => true | |
| 1.9.3p0 :004 > ['a', 2, Time.now].include? 1 | |
| => false | |
| 1.9.3p0 :005 > ['a', 2, Time.now, nil, 1].include? 1 | |
| => true |
| #!/usr/bin/env ruby | |
| require 'uri' | |
| require 'cgi' | |
| url = 'http://www.google.com/url?sa=t&rct=j&q=beef%20jerky%20recipe&source=web&cd=4&ved=0CIIBEBYwAw&url=http%3A%2F%2Fbeefjerkyrecipes.com%2F&ei=xYDiTvDfF6jw0gHRxrnyBQ&usg=AFQjCNG08v5ya0pv7pZ1ChlFUF7DZAF3Jg' | |
| uri = URI.parse url | |
| params = CGI.parse uri.query |