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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/253067.txt | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |
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
<%= f.select(:role_id, options_from_collection_for_select(@roles, "id", "to_s"), {:include_blank => true, :selected => nil}) %> |
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
>> m = {:fn=>"Mark Wunsch", :title=>["Front End Engineer at Scripps Networks"], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :adr=>[{:locality=>["Greater New York City Area"]}]} | |
# => {:fn=>"Mark Wunsch", :adr=>[{:locality=>["Greater New York City Area"]}], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :title=>["Front End Engineer at Scripps Networks"]} | |
>> m.class | |
# => Hash | |
>> m.to_yaml | |
# => "--- \n:fn: Mark Wunsch\n:adr: \n- :locality: \n - Greater New York City Area\n:n: \n :family_name: \n - Wunsch\n :given_name: \n - Mark\n:title: \n- Front End Engineer at Scripps Networks\n" | |
$ ruby -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
$(document).ready(function() { | |
$('.async').live('click', function() { | |
var current = $(this).text(); | |
if ( current == 'show' ) { | |
$(this).text('hide'); | |
} else if (current == 'hide') { | |
$(this).text('show'); | |
} | |
$.getJSON($(this).attr('href'), |
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
def detail | |
return unless check_format | |
@request = request | |
@version = params[:version] | |
@cycle = params[:cycle].to_i | |
raise ActiveRecord::RecordNotFound if @cycle < 2000 | |
@format = params[:format] | |
@base_uri = base_uri(@request, @cycle, @version) | |
@fec_candidate = FecCandidate.find_with_cycle_and_committee(@cycle.to_i,params[:id]) | |
if not @fec_candidate |
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
# Optimized for writes, sort on read | |
# LVC | |
redis.hset("bonds|1", "bid_price", 96.01) | |
redis.hset("bonds|1", "ask_price", 97.53) | |
redis.hset("bonds|2", "bid_price", 95.50) | |
redis.hset("bonds|2", "ask_price", 98.25) | |
redis.sadd("bond_ids", 1) | |
redis.sadd("bond_ids", 2) |
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
# Adapted from: http://ariejan.net/2010/04/25/ruby-version-and-gemset-in-your-bash-prompt-yes-sir | |
function rvm_version { | |
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') | |
[ "$gemset" != "" ] && echo "@$gemset" | |
} | |
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
# defines '__git_ps1' current git branch function | |
source ~/.git-completion.bash |
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
#!/usr/bin/env ruby | |
# Usage: | |
# git clog # prints | |
# git clog -w # writes | |
# | |
# https://gist.github.com/2880525 | |
module Clog | |
extend self |
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 'sinatra' | |
require 'sanitize' | |
TO_REMOVE = ["", " ", " "] | |
get '/' do | |
<<-HTML | |
<form method="post" action="sanitize"> | |
<textarea name="dirty" style="width:100%;height:800px;"></textarea> | |
<input type="submit" value="Submit"> |
OlderNewer