Skip to content

Instantly share code, notes, and snippets.

print "Fat: "
fat = gets.strip
print "Protein: "
protein = gets.strip
print "Carbohydrates: "
carbs = gets.strip
fat_calories = fat.to_f*9
Match (C:Cell) <- [*1..2] – (p:Cell) return c,p
@jjb
jjb / gist:92171243f87479f10fe6
Created December 9, 2014 21:10
primary and secondary DNS on DNS Made Easy

Keybase proof

I hereby claim:

  • I am jjb on github.
  • I am johnjosephbachir (https://keybase.io/johnjosephbachir) on keybase.
  • I have a public key whose fingerprint is C0BC 5EAB 0143 0A0C 1EF7 A2F8 C0A4 21F5 E525 9F60

To claim this, I am signing this object:

<a href="javascript:Intercom('show')">
Contact Support
</a>
def a
raise "i am in a"
end
def b
puts "i am in b"
a
end
def c
@jjb
jjb / gist:68b0b6a949d00360aa21
Created May 2, 2014 15:45
How to find a particular user's ActiveRecord session
ActiveRecord::SessionStore::Session.find_each do |session|
if (user_to_find.id == session.data["warden.user.user.key"][0][0] rescue false)
print "[#{session.id}]"
end
end
@jjb
jjb / gist:10000281
Last active August 29, 2015 13:58
how to experiment with rails fragment cache key generation in the console
# inside rails console
include ActionController::Caching::Fragments
fragment_cache_key [User.first, "hello", :monkey, false]
# => "views/users/1-20140404193333893414000/hello/monkey/false"
@jjb
jjb / 1. setup.sql
Created March 28, 2014 01:18
demonstration of behavior discussed in http://stackoverflow.com/questions/22389882
CREATE TABLE things (
id integer NOT NULL,
my_column varchar
);
insert into things (id) values (1);
insert into things (id) values (2);