View christmas.py
This file contains 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
print("Welcome Jeremy, we've been waiting for you.") | |
print("We're going to find out if you've been naughty or nice.") | |
print("Enter your grades one line at a time, then put DONE") | |
cipher = "Orrn#wr#wkh#ohiw#ri#wkh#Dufdgh#Fdelqhw" | |
grades = [] | |
grade = input() | |
View mysqldump_pre_commit_hook.bash
This file contains 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
#!/bin/bash | |
# Pre-commit hook to make a mysql dump right before committing and add it to the commit. | |
# | |
## Change the following values to suit your local setup. | |
# The name of a database user with read access to the database. | |
DBUSER=root | |
# The password associated with the above user. Leave commented if none. | |
#DBPASS=seekrit | |
# The database associated with this repository. | |
DBNAME=dplay |
View recurse.bash
This file contains 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
#!/bin/bash | |
# reCurse | |
# ======= | |
# Identicurse is awesome. Using the Git development branch is fun! | |
# But sometimes it crashes! o...o | |
# When that happens I feel obligated to file a bug report. | |
# But before I file a bug report, I should pull the latest HEAD from master to | |
# check if the bug is still present. | |
# It can get old fast... real fast. | |
# So I made that process easier for Archlinux folken. |
View snidely_poll.rb
This file contains 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
# Which ones. Pick one number and one letter. Reply back to | |
# @nuclearsandwich on identi.ca or @_nuclearsammich on Twitter. | |
# 1) .snidelyrc | |
# 2) .snidely | |
# 3) Snidefile | |
# 4) Snidely | |
# 5) Snidefile | |
# A) | |
Snidely.render do |configs| |
View a_look_at_case_expressions.rb
This file contains 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 Look at Case Expressions in Ruby | |
# ================================== | |
# | |
# *Side note: Playing with docco as a formatting tool for this article. Excuse | |
# the lines with solitary* `:parabreak` *symbols, they're to make paragraphs on the | |
# right hand side.* | |
# | |
# Ruby, like many languages has a case-when construct for more refined | |
# conditional execution than if-then-else can provide. Technically all case | |
# constructs could be written as if-then-else-if-then...else but you wouldn't |
View html.rb
This file contains 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
# Only working example so far HTML.new { html { title { "Hello" } } } | |
# Soon attributes will be working. | |
class HTML | |
def initialize &content | |
@html = "" | |
instance_eval &content | |
end | |
def method_missing tag, *attrs, &content |
View grr_active_record.rb
This file contains 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 has_many relation exists between a Twitter account and mentions. | |
# An instance of the collection of mentions is of class Array, rather than any kind of ActiveRecord relation. So one would assume that standard Enumerable methods work. But... | |
pry(Api)> cd Account::Twitter.last | |
pry(#<Api::Account::Twitter:0x10748de58>):1> mentions.class | |
=> Array < Object # Regular old array. | |
pry(#<Api::Account::Twitter:0x10748de58>):1> mentions.method :find | |
=> Array (Enumerable)#find(*arg1) # Looks like #find was defined in Enumerable and so should be Enumerable's find (hint: It isn't) | |
pry(#<Api::Account::Twitter:0x10748de58>):1> mentions.find { true } # This should return the first element in the Array. | |
ActiveRecord::RecordNotFound: Couldn't find Aji::Mention without an ID | |
from /Users/steven/.rvm/gems/ruby-1.9.2-p290@api/gems/activerecord-3.0.10/lib/active_record/relation/finder_methods.rb:287:in `find_with_ids' |
View gist:1306138
This file contains 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
Routing Error | |
No route matches {:action=>"show", :controller=>"programs", :user_id=>nil, :id=>#<Program _id: BSON::ObjectId('4ea2132db7e9fe27ce000001'), author_username: "nuclearsandwich", slug: "test", source_code: "Shoes.app do\n stack do\n 3.times do\n para \"Hello World!\", :font => \"TakaoGothic\"\n end\nend\n", title: "test">} | |
View hacket-stack
This file contains 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
Process: hacketyhack-bin [16501] | |
Path: /Applications/Hackety Hack.app/Contents/MacOS/./hacketyhack-bin | |
Identifier: org.hackety.hacketyhack | |
Version: 0.r1321 (???) | |
Build Info: Shoes-1200000~1 | |
Code Type: X86-64 (Native) | |
Parent Process: bash [16499] | |
Date/Time: 2011-10-23 18:54:53.863 -0700 | |
OS Version: Mac OS X 10.6.7 (10J4139) |
View gist:1333254
This file contains 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
gem 'rake' | |
gem 'thor' # Better command line utility than rake. | |
gem 'foreman' # Local process monitor. | |
gem 'grape', :git => 'git://github.com/intridea/grape.git' | |
gem 'sinatra', :require => 'sinatra/base' | |
gem 'thin' # Heroku recommends the Thin web server. | |
gem 'resque', :require => [ 'resque', 'resque/failure/redis' ] | |
gem 'typhoeus' # Better, Faster HTTP API for Faraday connections | |
gem 'hiredis' # Fast C Interface to Redis. | |
gem 'redis', :require => [ 'redis/connection/hiredis', 'redis' ] |
OlderNewer