Skip to content

Instantly share code, notes, and snippets.

# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
#!/bin/bash
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
# Created By: Sohail Riaz ([email protected])
PROG=red5
RED5_HOME=/usr/local/red5
@hchoroomi
hchoroomi / webapp.rb
Created November 22, 2010 19:46 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@hchoroomi
hchoroomi / about.md
Created August 30, 2011 09:44 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@hchoroomi
hchoroomi / spec_helper.rb
Created September 14, 2011 08:40 — forked from ryanb/spec_helper.rb
Focus on specific specs in RSpec
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
# and then use the :focus tag in your specs
it "does something awesome", :focus do
@hchoroomi
hchoroomi / spec_helper.rb
Created September 14, 2011 08:40 — forked from ryanb/spec_helper.rb
Use RSpec tags to add behavior around specs.
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr => true) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
example.call
end
end
end
@hchoroomi
hchoroomi / unshredder.rb
Created November 15, 2011 15:09 — forked from sausheong/unshredder.rb
For the Instagram Challenge - Unshredder
require 'rmagick'
include Magick
shredded = ImageList.new "TokyoPanoramaShredded.png" # the original source
ROWS = shredded.rows # number of lines of pixes
working = [] # a working array of images
def strip_width
32
end
Gem::Specification.new do |s|
s.name = 'bang'
s.version = '0.1.0'
s.platform = Gem::Platform::RUBY
s.author = 'Jeff Kreeftmeijer'
s.email = '[email protected]'
s.summary = 'Bang!'
s.description = 'Bangs existing model methods'
s.files = ['bang.rb']
# Pass in the name of the site you wich to create a cert for
domain_name = ARGV[0]
if domain_name == nil
puts "Y U No give me a domain name?"
else
system "openssl genrsa -out #{domain_name}.key 1024"
system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=NJ/L=Monroe/O=MyCompany/OU=IT/CN=#{domain_name}'"
system "cp #{domain_name}.key #{domain_name}.key.bak"