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
| #!/bin/bash | |
| sudo rmmod psmouse && sudo modprobe psmouse |
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
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
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
| #!/bin/bash | |
| git diff --numstat | awk '{if ($1 == "0" && $2 == "0") print $3}' | xargs git checkout HEAD |
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 'yaml' | |
| require 'logger' | |
| require 'active_record' | |
| namespace :db do | |
| def create_database config | |
| options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'} | |
| create_db = lambda do |config| | |
| ActiveRecord::Base.establish_connection config.merge('database' => 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
| /* | |
| * add this to your own css file, | |
| * to overwrite the _chosen_ styling, to look more like bootstrap! | |
| * | |
| * note: for the error part to work, an .error class-name must be added | |
| * to a wrapping DIV, to display the bootstrap error styling. I have | |
| * just use the wrapping .control-group DIV | |
| * | |
| * credit: Rasmus Burkal, @rabu81 | |
| */ |
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 Resque | |
| def push_with_meta(queue, item) | |
| if item.respond_to?(:[]=) | |
| item[:meta] = {:queued_at => Time.now.to_f} | |
| end | |
| push_without_meta(queue, item) | |
| end | |
| class Job | |
| # Returns a Hash of the meta data related to this Job. |
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
| # Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })} | |
| RSpec::Matchers.define :accept_nested_attributes_for do |association| | |
| match do |model| | |
| @model = model | |
| @nested_att_present = model.respond_to?("#{association}_attributes=".to_sym) | |
| if @nested_att_present && @reject | |
| model.send("#{association}_attributes=".to_sym,[@reject]) | |
| @reject_success = model.send("#{association}").empty? | |
| end | |
| model.send("#{association}").clear |
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
| getVisibleParent = (element) -> | |
| parents = element.parent(':visible') | |
| if parents.length == 0 | |
| getVisibleParent(element.parent()) | |
| else | |
| parents |
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
| #!/bin/bash | |
| if [ -z "$1" ] | |
| then | |
| echo "No dropbox profile specified" >&2 | |
| echo "Usage: $(basename "$0") profile command" >&2 | |
| exit 1 | |
| fi | |
| fold="$1" |