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
@reinh
reinh / gist:41325
Created December 29, 2008 17:50 — forked from rezaprima/gist:39869
function current_git_branch {
git branch 2> /dev/null | grep '\*' | awk '{print $2}'
}
hack()
{
CURRENT=$(current_git_branch)
git checkout master
git pull origin master
git checkout ${CURRENT}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the Parser 2 API version of the LetMeGoogleThatForYou *
* Ubiquity script compatible with Ubiquity 0.5+. *
* The Legacy parser version is available at *
* http://gist.github.com/45201 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var icon = "http://letmegooglethatforyou.com/favicon.ico";
var tu_desc = "<a href=\"http://www.tinyurl.com\">TinyUrl</a>";
var lmg_desc = "<a href=\"http://lmgtfy.com\">Let Me Google That For You</a>";
@reinh
reinh / gist:180799
Created September 4, 2009 08:42 — forked from anonymous/gist:180794
def do_something
action = case
when self.play?: true ? 'play football' : 'do nothing'
when self.work?: 'go to work'
when self.sleep?: 'sleep'
else: 'What?'
end
return action
end
@reinh
reinh / run_tags.rb
Created November 3, 2009 22:32 — forked from tobias/run_tags.rb
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/usr/bin/env ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
def update_main_artist
artist = rovi_artist ? Artist.find_or_create_by_name rovi_artist.name : artists.first
update_attribute :main_artist_id, artist.id
end
@reinh
reinh / i-am-sorry.txt
Created March 20, 2012 19:59 — forked from robbyrussell/i-am-sorry.txt
apology ideas for @sqoot
Dear friends, we are truly sorry. You're right. We live in a bubble
and have a lot to learn. We need to do some soul searching and
practice mindfulness going forward. We hope that, in time, you'll
forgive us. Ladies.
@reinh
reinh / index.html
Created May 24, 2012 03:27 — forked from mbostock/.block
Axis Component
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;