Skip to content

Instantly share code, notes, and snippets.

View jarinudom's full-sized avatar

Jarin Udom jarinudom

View GitHub Profile
class Array
def rand
self[super(self.length)]
end
end
[1, 2, 3, 4, 5].rand #=> 4
$ gem install refraction
config.gem "refraction"
config.middleware.insert_before(::Rack::Lock, ::Refraction, {})
Refraction.configure do |req|
if req.host == "example.com"
req.permanent! :host => "www.example.com"
end
end
require 'formula'
require 'hardware'
class Mongodb <Formula
homepage 'http://www.mongodb.org/'
aka :mongo
if Hardware.is_64_bit? and not ARGV.include? '--32bit'
url 'http://downloads.mongodb.org/osx/mongodb-osx-x86_64-1.3.0.tgz'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=720, user-scalable=yes"/>
<meta name="description" content="{MetaDescription}"/>
<title>{Title}{block:PostSummary} - {PostSummary}{/block:PostSummary}</title>
<!-- DEFAULT COLORS -->
******************************************************
* TICKET #2402-811 *CLOSED* 2010-02-24 *
******************************************************
* *
* ASSIGNED : n/a *
* DEPT CODE : AAV *
* CUSTOMER : 84125, James A------ *
* WORKSTAION: BCDM-643843 *
* SITE : M/BCD *
* *
<profile>
<site_url>http://www.setformarriage.com</site_url>
<url>http://www.setformarriage.com/users/1</url>
<user_name>Brad</user_name>
<dob>1979-10-12</dob>
<gender>male</gender>
<seeking>female</seeking>
<zip>77054</zip>
<photo>http://www.setformarriage.com/system/photos/1/dsh/DSC06644.JPG?1281329860</photo>
<description>I am a successful entrepreneur who has a passion for business. Running this website and making it as successful as possible along with helping as many people as I can keeps my fire burning. </description>
# lib/priority_mapper.rb
module PriorityMapper
extend ActiveSupport::Concern
module InstanceMethods
def priority_human
case priority
when 1
'High'
when 2