Public Gists by mischa

Gravatar
Sun Jun 07 00:51:15 -0700 2009
1
2
3
require 'twitter'
 
 
Gravatar
Tue Jun 02 10:45:21 -0700 2009
1
2
3
# Relating to: https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/332-cucumber-server
 
 
Gravatar
Fri May 08 17:14:32 -0700 2009
1
2
3
I would start by running the test stuff.
 
test = euclidean(@people, 'Lisa Rose', 'Gene Seymour')
Gravatar
Sun May 03 23:33:08 -0700 2009
1
2
3
# When a spammer wants to attack your site, they'll likely send an automated bot
# that will blindly fill out any forms it encounters. The idea of a "honeypot" is that
# you place a hidden field in a form. That's the honeypot. If this field is filled in, then
Gravatar
Wed Apr 29 06:55:15 -0700 2009
1
2
3
class ActionController::Request # ActionController::AbstractRequest in Rails < 2.3
  # Returns true if the request seems to come from a bot
  def bot?
Gravatar
Tue Mar 03 04:46:55 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
# The script that give you focus!
Gravatar
Sat Feb 28 17:26:10 -0800 2009
1
2
3
(This is the text of the keynote I gave at Startup Riot 2009. Will update when video becomes available.)
 
Hi everyone, I'm Chris Wanstrath, and I'm one of the co-founders of GitHub.
Gravatar
Sat Jan 03 21:46:49 -0800 2009
1
2
3
#features/steps/users_steps.rb:
 
Given "I'm a logged in member" do
Gravatar
Fri Jan 02 16:22:30 -0800 2009
1
2
3
# Inject
%w{earl-grey peach white}.inject({}) do |hash, string|
  hash[string] = "tea"
Gravatar
Wed Dec 31 02:58:24 -0800 2008
1
2
3
#
# Why setting the default value of a Hash to be a Hash is wrong
#
Gravatar
Mon Dec 29 20:15:49 -0800 2008
1
2
3
require 'rubygems'
require 'stemmer'
require 'classifier'
Gravatar
Tue Dec 23 01:49:26 -0800 2008
1
2
3
class MischaTime < Struct.new(:hours, :minutes, :seconds); end
 
def time_diff(t1, t2)
Gravatar
Tue Dec 23 01:49:03 -0800 2008
1
2
3
(define-struct time (hours minutes seconds))
 
(define (time-point hours minutes seconds)
gist: 38571 closures in ruby
Gravatar
Sat Dec 20 20:57:06 -0800 2008
1
2
3
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
 
Gravatar
Sat Dec 20 06:32:39 -0800 2008
1
2
3
  # Any Model
  def to_s
    name
Gravatar
Sat Dec 20 05:40:25 -0800 2008
1
2
3
 def link_to(*args, &block)
        if block_given?
          options = args.first || {}
Gravatar
Sat Dec 20 05:37:41 -0800 2008
1
2
3
  
#app/views/users/index.rb
<% @users.each do |user| %>
Gravatar
Mon Dec 15 20:39:44 -0800 2008
1
2
3
module FlashHelper
  
  def flashes
gist: 36235 Run Railroad as a rake task
Gravatar
Mon Dec 15 18:52:00 -0800 2008
1
2
3
#(Thanks to Thomas Ritz, http://www.galaxy-ritz.de ,for the code.)
 
  namespace :doc do
Gravatar
Fri Dec 12 07:56:18 -0800 2008
1
2
3
if [child, parent, grandpa, president, food, ink].all{|e| e.valid?}
  ... #do stuff
end