Skip to content

Instantly share code, notes, and snippets.

View trobrock's full-sized avatar

Trae Robrock trobrock

View GitHub Profile
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
module FacebookSession
module Session
def self.included(base)
base.class_eval do
cattr_accessor :finding_current
include Methods
end
end
module Methods
@acrosa
acrosa / oauth-monkey-patch.rb
Created December 13, 2010 12:20
OAuth gem workaround on JRuby
module OAuth::Signature::HMAC
class Base < OAuth::Signature::Base
private
def digest
self.class.digest_class Object.module_eval("::Digest::#{self.class.digest_klass}")
digest = OpenSSL::Digest::Digest.new('sha1')
OpenSSL::HMAC.digest(digest, secret, signature_base_string)
end
end
end
@paneq
paneq / capc.rb
Created January 27, 2011 18:50
Creating an object with Capybara api and jumping into it.
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup(:default, :test) if defined?(Bundler)
require "selenium-webdriver"
require 'capybara/dsl'
Capybara.default_driver = :selenium
Capybara.default_selector = :css
Capybara.default_wait_time = 5
@adamloving
adamloving / installer_controller.rb
Created February 1, 2011 06:11
Rails controller action for an HTML5 cache manifest file.
class InstallerController < ApplicationController
# Rails controller action for an HTML5 cache manifest file.
# Generates a plain text list of files that changes
# when one of the listed files change...
# So the client knows when to refresh its cache.
def cache_manifest
@files = ["CACHE MANIFEST\n"]
@files << 'favicon.ico'
@bcurren
bcurren / redis_pubsub_demo.rb
Created May 3, 2011 21:19 — forked from pietern/redis_pubsub_demo.rb
Updated redis pubsub with cramp
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@mattpodwysocki
mattpodwysocki / jsconf2011-talks.txt
Created May 5, 2011 18:30
JSConf talks and resources
Track A
Bytes and Blobs – David Flanagan @__DavidFlanagan
Slides: http://davidflanagan.com/Talks/jsconf11/BytesAndBlobs.html
Conference Wifi Redux - Malte Ubi @cramforce
Sashimi: https://github.com/cramforce/Sashimi
Slides: http://social-traffic.streamie.org/preso/static/#slide1
Run Your JS everywhere with Jellyfish – Adam Christian @admc
@nstielau
nstielau / set_environment.rb
Created May 9, 2011 00:04
A Knife plugin to set node environment
## Knife plugin to set node environment
# See http://wiki.opscode.com/display/chef/Environments
#
## Install
# Place in .chef/plugins/knife/set_environment.rb
#
## Usage
# Nick-Stielaus-MacBook-Pro:chef-repo nstielau$ knife node set_environment mynode.net my_env
# Looking for mynode.net
# Setting environment to my_env
anonymous
anonymous / gist:1043991
Created June 24, 2011 00:42
Fork server to run integration tests while cleaning up processes.
pid = fork { exec("script/server") }
sleep(10)
puts "Test 1"
puts "Test 2"
puts "Test 3"
Process.kill("KILL", pid) rescue nil
pid, status = Process.waitpid2(pid)
@sirupsen
sirupsen / vim7.3_mac_install.rb
Created July 27, 2011 21:57 — forked from pengwynn/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end