Skip to content

Instantly share code, notes, and snippets.

View mikehale's full-sized avatar

Michael Hale mikehale

  • Heroku
  • Holly Springs, NC
View GitHub Profile
This is the top level god configuration. Basically the only thing that needs to be set here is the name of the application. Then require the various recipes.
APPLICATION="whatever"
require 'mongrel'
@mikehale
mikehale / monit.sh
Created August 7, 2008 20:12
Monit Upstart Script
# This is an event.d (upstart) script to keep monit running
# To install disable the old way of doing things:
#
# /etc/init.d/monit quit && update-rc.d -f monit remove
#
# then put this script here: /etc/event.d/monit
#
# You can manually start and stop monit like this:
#
# start monit
class ContestController < ApplicationController
session :off
no_login_required
skip_before_filter :verify_authenticity_token
def index
render :text => "helloworld!"
end
def create
require 'config/recipes/dns'
def parse_headers
request = "GET /remote/path/img.gif HTTP/1.1\r\nAccept-Language: en-us,en;q=0.5\r\nCache-Control: max-age=0\r\nIf-None-Match: \"58dc30c-216-3d878fe2\"-gzip\r\nX-Forwarded-For: 127.0.0.1\r\nAccept: image/png,image/*;q=0.8,*/*;q=0.5\r\nConnection: Keep-Alive\r\nX-Forwarded-Server: www.example.com\r\nAccept-Encoding: gzip,deflate\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4\r\nCookie: cookie1=YWJj; cookie2=ZGVm\r\nReferer: http://www.example.com/posts/\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nHost: localhost:4001\r\nX-Forwarded-Host: www.example.com\r\nIf-Modified-Since: Tue, 17 Sep 2002 20:26:10 GMT\r\n\r\n"
tmp = {}
request.split("\r\n")[1..-1].each{|e|
k,v = e.split(': ')
tmp[k]=v
}
tmp
end
def foo
puts 'You called foo!';
end
method = self.method(:foo)
#These do the same thing
method.call
foo
We couldn’t find that file to show.
Process: System Preferences [45379]
Path: /Applications/System Preferences.app/Contents/MacOS/System Preferences
Identifier: com.apple.systempreferences
Version: 5.2 (5.2)
Build Info: SystemPrefsApp-1510800~2
Code Type: X86 (Native)
Parent Process: launchd [223]
Date/Time: 2009-01-30 14:13:16.088 -0500
OS Version: Mac OS X 10.5.6 (9G55)
# Generates an list of gem install commands. Useful for moving to enterprise ruby.
existing_gems = %<actionmailer (2.0.2, 1.3.6)
actionpack (2.0.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.0.2, 1.15.6)
activeresource (2.0.2)
activesupport (2.0.2, 1.4.4)
existing_gems.each do |line|