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
$ ruby proctest.rb | |
1 | |
proctest.rb:2:in `block in <main>': wrong number of arguments (2 for 1) (ArgumentError) | |
from proctest.rb:5:in `call' | |
from proctest.rb:5: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
# Data looks like: | |
# { | |
# #"old": new, | |
# "7583": 201343, | |
# "7614": 280397, | |
# "8381": 285146, | |
# "9197": 285727, | |
# "9356": 220591, | |
# } |
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
79271 | |
104677 | |
107019 | |
174413 | |
201911 | |
198794 | |
209420 | |
208774 | |
62819 | |
181205 |
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
#!/usr/bin/env ruby | |
# $ ./reverse_vowels.rb 'lalelilolul' | |
# lulolilelal | |
# $ ./reverse_vowels.rb 'lalelilolu' | |
# lulolilela | |
VOWELS = 'aeiouy' | |
string = ARGV[0] |
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
Host my.remote.host | |
RemoteForward 12888 localhost:12888 |
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
vnoremap <Leader>y :yank:call system('nsend ', @0)<CR> |
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
@a = true | |
@b = false | |
def one_way | |
@a and @b ? 'surprise!' : 'expected' | |
end | |
def the_other_way | |
@b and @a ? 'surprise!' : 'expected' | |
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
#!/usr/bin/env ruby | |
PROTOCOL = %r{[\w-]+://?} | |
URL = %r{^((#{PROTOCOL}|\w+[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))$} | |
args = ARGV.to_a | |
args.each_with_index do |arg, i| | |
args[i] = "https://#{arg}" if arg =~ URL && arg !~ PROTOCOL | |
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
function loadenv() { | |
env=${1:-.env} | |
echo Loading $env | |
file=`mktemp -t tmp` | |
if [ -f $env ]; then | |
cat $env | while read line; do | |
echo export $line >> $file | |
done | |
source $file | |
else |
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
require 'rubygems' | |
require 'rest_client' | |
TOKEN = ENV['TOKEN'] | |
PHOTO_ENDPOINT = 'https://api.singly.com/types/photos' | |
PHOTO_PATH = ARGV[0] | |
puts "Uploading #{PHOTO_PATH}" | |
puts RestClient.post(PHOTO_ENDPOINT, { |