Skip to content

Instantly share code, notes, and snippets.


Michael Bleigh mbleigh

View GitHub Profile
mbleigh / .travis.yml
Created Oct 30, 2014
Octopress + Travis CI + Divshot
View .travis.yml
language: ruby
- 2.1.0
script: bundle exec rake generate
provider: divshot
master: development
staging: staging
production: production
View Alternative.rb
# I hear that aliasing lambda is bad, but this is
# much more readable...
alias :this_block :lambda
this_block{ @this.destroy }.should change(Thing, :count).by(-1)
View gist:26189
# Post-Commit Hook for Git
# change your subdomain, username and password, then copy this file as .git/hooks/post-commit
# then 'chmod +x .git/hooks/post-commit'
# it'll run every time you commit (not push, mind you)
$project='Project Name'
View gist:46651
>> ActionController::UrlWriter.default_url_options
=> {:host=>nil}
>> ActionController::UrlWriter.default_url_options[:host] = ''
=> ""
>> ActionController::UrlWriter.default_url_options[:host]
=> ""
View twitter_search_plus.user.js
// ==UserScript==
// @name Twitter Search Plus
// @namespace intridea
// @description Find replies to a tweet in the Twitter Search timeline with the click of a button.
// @include*
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = '';
View github-project-puller.js
jQuery.githubUser = function(username, callback) {
jQuery.getJSON("" + username + "?callback=?", callback);
$.githubUser('mbleigh', function(data) {
var repos = data.user.repositories;
repos.sort(function(a,b) {
return b.watchers - a.watchers;
View .autotest
Autotest.add_hook :initialize do |at|
at.add_mapping(/app\/shared\/.*\.rb/) do
at.files_matching /^app\/shared\/spec\/(models)\/.*_spec\.rb/
View twitter_app.rb
app_name = ask("What is your application called?")
puts "\nBefore this generator runs you will need to register your Twitter application for OAuth at, then enter the consumer key and secret below:\n\n"
consumer_key = ask("OAuth Consumer Key:")
consumer_secret = ask("OAuth Consumer Secret:")
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm README"
run "cp config/database.yml config/database.yml.example"
View gist:100161
class User < TwitterAuth::GenericUser
def refresh_twitter_attributes!
View gist:100269
# OptionsProxy creates a proxy object with attribute accessors
# and defaults.
options =, :name, {
:fancy => true
options.fancy # => true # => nil
You can’t perform that action at this time.