Skip to content

Instantly share code, notes, and snippets.

stargate:rb mchung$ cat binding.rb
# Return bindings
def f
a = 42
b = "foo"
binding
end
f_vars = f()
# libxml-ruby segfault
require 'rubygems'
require 'xml'
def try(&block)
begin
yield if block_given?
rescue
puts "err: #{$!}"
document.write("oh hai")
class Selfoo
# bar # Why doesn't this work?
def self.foo
puts "foo"
end
class << self
# puts foo # Why doesn't this work?
inputs = args
spec = Gisting::Spec.new
inputs.each do |file_input|
input = spec.add_input
input.file_pattern = file_input
input.map do |map_input|
# 2722 mailbox 2006-05-23 00:08:39
# 217 - 2006-05-23 15:41:48
# 1326 www.crazyradiodeals.com 2006-05-23 18:00:30
# 2722 mailbox 2006-05-23 00:08:39
require 'rubygems'
require 'net/ldap'
# sudo gem install ruby-net-ldap
HOSTNAME = "foo.local"
BASENAME = "dc=openrain,dc=com"
PORT = 389
puts "What's your username"
username = STDIN.readline.chomp
class UsersController < ApplicationController
include Clearance::App::Controllers::UsersController
# Override and add in a check for invitation code
def create
@user = User.new params[:user]
invite_code = params[:invite_code]
@invite = Invite.find_redeemable(invite_code)
if invite_code && @invite
require 'test_helper'
module Clearance
module Shoulda
def should_create_user_successfully
# Don't need this test.
end
end
end
require 'digest/sha1'
class Invite < ActiveRecord::Base
validates_presence_of :email, :on => :save, :message => "can't be blank"
validates_uniqueness_of :email, :on => :save, :message => "is already registered"
named_scope :unsent_invitations, :conditions => {:redeemed_at => nil, :invite_code => nil}
def invited?
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#