Skip to content

Instantly share code, notes, and snippets.

// Convert to jQuery please...
var field = $('password_confirmation_field');
field.hide();
$('user_password').observe('focus', field.show.bind(field));
// This the best?
var confirmation = $('#password_confirmation_field').hide();
$('#user_password').focus(function () {
confirmation.show();
});
// Examples:
//
// HTML:
// <form action='messages/1/mark_unread'><input type='submit' class='button_to_link' value='Mark Unread'/></form>
//
// Rails:
// button_to "Mark as unread", mark_as_unread_message_path(message), :method => :put, :class => "button_to_link"
//
// jQuery:
// $(document).ready(function() {
@reinh
reinh / hack
Created August 28, 2008 02:15 — forked from rick/hack
#!/bin/sh -x
# hack
CURRENT=`git branch | grep "\*" | awk "{print $2}"`
git checkout master
git pull origin master
git checkout ${CURRENT}
git rebase master
alias ssp="hack && rake && ship"
#!/bin/sh -x
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git pull origin master
git checkout ${CURRENT}
git rebase master
#!/bin/sh -x
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git merge ${CURRENT}
git push origin master
git checkout ${CURRENT}
#!/usr/bin/env ruby
require 'net/http'
require 'optparse'
require 'timeout'
require 'cgi'
class Hash
def to_query_string
map { |k, v|
class Organization
def inspect
"An Organization for #@param"
end
def initialize(param)
@param = param
end
def self.find(param)
@reinh
reinh / vimeo.rb
Created September 12, 2008 15:46
Vimeo User REST client
require 'rubygems'
require 'activesupport'
require 'httparty'
module Vimeo
# Wrapper around the Vimeo REST service for a user.
# Usage:
# Vimeo::User.new('brad').clips.each{ |clip| p clip.embed }
#
class User
module ::ActionController
class Base
def self.inherited_with_facebooker(subclass)
inherited_without_facebooker(subclass)
if subclass.to_s == "ApplicationController"
subclass.send(:include,Facebooker::Rails::Controller)
subclass.helper Facebooker::Rails::Helpers
end
end
class << self