Skip to content

Instantly share code, notes, and snippets.

@dmonopoly
dmonopoly / gist:1164395
Created August 23, 2011 05:16
nil and false notion...
def mealtimes(meal)
arr = [meal.breakfast, meal.lunch, meal.dinner]
if arr == [true, true, true]
"breakfast, lunch, and dinner"
elsif arr == [false, false, false]
""
elsif arr == [true, true, false]
"breakfast and lunch"
elsif arr == [true, false, true]
"breakfast and dinner"
@dmonopoly
dmonopoly / help with show.js.coffee
Created July 22, 2011 22:38
Coffeebeans; trying to get app/views/restaurants/show.js.coffee to work; the alert doesn't appear
# Controller
class RestaurantsController < ApplicationController
def show
@restaurant = Restaurant.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js # show.js.coffee
end
end
end
@dmonopoly
dmonopoly / ssh key problem
Created June 21, 2011 20:45
after transferring my public and private key to a new machine, permissions on the private key changed, leading to this error.
$ ssh git@github.com -v
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/daze/.ssh/identity type -1
debug1: identity file /Users/daze/.ssh/id_rsa type 1
debug1: identity file /Users/daze/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*