This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def title_case! | |
self.split.map{ |w| w.capitalize }.join(' ') | |
end | |
end | |
class Hash | |
def title_case_keys! | |
self.each_pair do |k,v| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module StateMachine | |
def self.included(klass) | |
klass.extend ClassMethods | |
end | |
def self.wrap_method(klass, name) | |
original_method = "original_#{name}" | |
before_method = "before_#{name}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :application, "phonegap" | |
set :deploy_to, "/var/www/phonegap.com" | |
set :tmp, "#{application}_update" | |
set :app_root, "/" | |
set :user, "root" | |
set :use_sudo, true | |
role :web, "phonegap.com" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require "hpricot" | |
PHONEGAP_WEB_PATH = "iphone/www" | |
namespace :iphone do | |
task :default => [:import] do | |
end | |
desc 'reverts file back to original form' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################### | |
# Merb.run_later issues | |
####################### | |
Here is what I am running. | |
- Slicehost account | |
- Ubuntu 8.04 | |
- jruby 1.1.5 (ruby 1.8.6 patchlevel 114) (2008-11-03 rev 7996) [amd64-java] | |
- glassfish V3 (0.9.1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Page Title</title> | |
<script type="text/javascript" charset="utf-8"> | |
//paste XUI here | |
getImage = function(){ | |
x$("#imagebox").xhr("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", | |
{callback:function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ##################################### | |
# Who is the killer? | |
# ##################################### | |
# | |
# Handel has been killed and Beethoven is on the case. He has | |
# interviewed the four suspects and their statements are shown below. | |
# Each suspect has said two sentences. One sentence of each suspect is a | |
# lie and one sentence is the truth. Help Beethoven figure out who the | |
# killer is. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link id="css" href="stylesheets/main.css" rel="stylesheet" type="text/css" /> | |
<script type="text/javascript" charset="utf-8"> | |
(function(){ | |
var ua = navigator.userAgent; | |
if(ua.match("iPhone") || ua.match("Android")){ | |
document.getElementById("css").href = "stylesheets/mobile.css"; | |
var meta = document.createElement("META"); | |
meta.setAttribute('content','width=320; initial-scale=1.0; maximum-scale=2.0;'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ | |
margin:0; | |
font-family:Helvetica, Arial; | |
font-size:84%; | |
} | |
a{ | |
color:#24F; | |
font-weight:bold; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hits < Application | |
# this is a nested resource with only a create method | |
# we use render_then_call (merb only) just to pass back | |
# a 200 status before doing the calculation | |
# this action is hit with a XHR POST that looks like... | |
# http://example.com/shot/4587/hit | |
# | |
def create | |
only_provides :js |
OlderNewer