Skip to content

Instantly share code, notes, and snippets.

@celeen
celeen / yolo.rb
Created June 19, 2014 21:10
rake db:yolo - for experimenting with active record
desc 'Fuck it. Try again.'
task "db:yolo" => [:"db:drop", :"db:create", :"db:migrate"] do
puts "YOLO MOFOS"
end
@celeen
celeen / console.rb
Created June 19, 2014 21:11
Note to self: this is one way to write a console task in rake, using IRB
desc 'CONSOLE-ATION'
task "db:console" do
require 'irb'
ARGV.clear
IRB.start
end
@celeen
celeen / pre-commit
Last active August 29, 2015 14:13
commit-hook for finding text
#!/usr/bin/env python
import sys, os, re
import subprocess
diff = subprocess.check_output(['git', 'diff', 'HEAD'])
def check_for_text(text, diff):
exp = re.compile(text)
match = exp.search(diff)
alias ..='cd ..'
# alias go_jenkins=‘launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist’
# alias stop_jenkins=‘launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist’
alias getcurl='python ~/Documents/scripts/curl_extractor.py'
alias getbash='subl ~/.bash_profile'
alias startHub='java -jar ~/Work/selenium/selenium-server-standalone-2.44.0.jar -role hub'
alias be='bundle exec'
alias scheme='/Applications/mit-scheme.app/Contents/Resources/mit-scheme'
@celeen
celeen / gist:81c6d6d28a3f64a3415e
Created June 15, 2015 23:53
Class methods, Instance Methods, and Modules
module Action
def self.doing_things
puts "HI"
end
def do_a_thing
puts "hi"
end
end
@celeen
celeen / separate_number.rb
Created August 8, 2015 17:55
separate_number refactor for Phil
def separate_comma(num)
string = num.to_s #turn integer into string
z = -4
while z > -(string.length+1)
string.insert(z, ",")
z -= 4
end
string
# Create a new list
# Add an item with a quantity to the list
# Remove an item from the list
# Update quantities for items in your list
# Print the list (Consider how to make it look nice!)
# DEFINE 'create_list' which takes no arguments:
# create/return a new, empty, hash
#
# DEFINE 'add', which takes three arguments, item (a string) and quantity (an integer), and list (a hash):