Skip to content

Instantly share code, notes, and snippets.

@naush
naush / cookie.clj
Created July 18, 2012 13:39
How to Unset Cookie with Ring
HEY_JUDE = <<-BEATLES
Hey jude, don't make it bad.
Take a sad song and make it better.
Remember to let her into your heart,
Then you can start to make it better.
Hey jude, don't be afraid.
You were made to go out and get her.
The minute you let her under your skin,
Then you begin to make it better.
@naush
naush / gist:2819374
Created May 28, 2012 14:06
Nobel Prize and Chinese
Q: Has there been any Chinese awarded the Nobel Prize?
A: Yes, but they all hold foreign passports (Samuel C. C. Ting, Yuan T. Lee, Steven Chu, Daniel C. Tsui, Roger Y. Tsien, Pearl S. Buck).
Q: Has there been any Chinese citizen awarded the Nobel Prize?
A: Yes, but they are all citizens of the Republic of China (Tsung-Dao Lee, Chen Ning Yang).
Q: Has there been any citizen of modern China awarded the Nobel Prize?
A: Yes, but he does not admit to be a Chinese citizen (Gao Xingjian).
Q: Has there been any citizen of modern China, who admits to be Chinese, awarded the Nobel Prize?
@naush
naush / gist:2392644
Created April 15, 2012 12:54
Toshio Suzuki Interview 2005

"In traditional Japanese architecture, you start with one room—maybe the alcove, where you hang some pictures. You spend a lot of time trying to pick the right shelves, the right little pillar, what kind of handles the drawers will have. Only when you finish that room do you worry about the next. In the West, you start from the general and go to the specific. A Hitchcock movie might start off with a panorama of the city, and then the camera closes in on a street, and a house, and then the stairway inside. If you’re a Japanese filmmaker, you might start with the railing on the stairway."

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 327 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: /usr/lib/ruby/1.8/securerandom.rb:53:in `random_bytes': PRNG not seeded (OpenSSL::Random::RandomError)
remote: from /usr/lib/ruby/1.8/securerandom.rb:53:in `random_bytes'
remote: from /usr/lib/ruby/1.8/securerandom.rb:91:in `hex'
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/activesupport_notifications_backport-0.0.4/lib/active_support/notifications/instrumenter.rb:29:in `unique_id'
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/activesupport_notifications_backport-0.0.4/lib/active_support/notifications/instrumenter.rb:7:in `initialize'
unless ARGV.size == 2
puts "USAGE: ruby draw_something.rb ACKRCKOOLCWZ 5"
exit 1
end
letters = ARGV[0].downcase.split(//).sort
length = ARGV[1].to_i
require 'open-uri'
uri = 'http://static.iminlikewithyou.com/drawsomething/wordlist.csv'
unless ARGV.size == 2
puts "USAGE: ruby guess.rb ACKRCKOOLCWZ 5"
exit 1
end
letters = ARGV[0]
limit = ARGV[1]
words = Hash.new { |h, word| h[word] = false }
(60 * 60).seconds # => 3600 seconds
(60 * 60).seconds.parts # => [[:seconds, 3600]]
(60 * 60).seconds.parts.size # => 1
([1.second] * 60 * 60).sum # => 3600 seconds
([1.second] * 60 * 60).sum.parts.size # => 3600
1.day.ago # => Sun, 11 Mar 2012 18:58:25 EDT -04:00
24.hours.ago # => Sun, 11 Mar 2012 18:58:28 EDT -04:00
2.days.ago # => Sat, 10 Mar 2012 18:58:35 EST -05:00
48.hours.ago # => Sat, 10 Mar 2012 17:58:38 EST -05:00
# multiple exits
if a
code
code
code
if b
code
code
code
return c