Skip to content

Instantly share code, notes, and snippets.

Brock Whitten sintaxi

Block or report user

Report or block sintaxi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:27148
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|
View gist:29357
module StateMachine
def self.included(klass)
klass.extend ClassMethods
end
def self.wrap_method(klass, name)
original_method = "original_#{name}"
before_method = "before_#{name}"
View gist:32194
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"
View Rakefile
require 'rubygems'
require "hpricot"
PHONEGAP_WEB_PATH = "iphone/www"
namespace :iphone do
task :default => [:import] do
end
desc 'reverts file back to original form'
View gist:55287
#######################
# 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)
@sintaxi
sintaxi / index.html
Created Feb 5, 2009
xhr request to flickr using XUI
View index.html
<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(){
View who_is_the_killer.rb
#
# #####################################
# 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.
View iphone css with only javascript
<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;');
View mobile.css
body{
margin:0;
font-family:Helvetica, Arial;
font-size:84%;
}
a{
color:#24F;
font-weight:bold;
}
View hits.rb
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
You can’t perform that action at this time.