Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@mbleigh
mbleigh / .travis.yml
Created October 30, 2014 04:59
Octopress + Travis CI + Divshot
language: ruby
rvm:
- 2.1.0
script: bundle exec rake generate
deploy:
provider: divshot
environment:
master: development
staging: staging
production: production
# 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)
#!/usr/bin/perl
# Present.ly 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'
$subdomain='yoursubdomain'
$username='username';
>> ActionController::UrlWriter.default_url_options
=> {:host=>nil}
>> ActionController::UrlWriter.default_url_options[:host] = 'abc.com'
=> "abc.com"
>> ActionController::UrlWriter.default_url_options[:host]
=> "abc.com"
>>
// ==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 http://search.twitter.com/search*
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
jQuery.githubUser = function(username, callback) {
jQuery.getJSON("http://github.com/api/v1/json/" + username + "?callback=?", callback);
}
$.githubUser('mbleigh', function(data) {
$('#github-projects').html('');
var repos = data.user.repositories;
repos.sort(function(a,b) {
return b.watchers - a.watchers;
Autotest.add_hook :initialize do |at|
at.add_mapping(/app\/shared\/.*\.rb/) do
at.files_matching /^app\/shared\/spec\/(models)\/.*_spec\.rb/
end
end
app_name = ask("What is your application called?")
puts "\nBefore this generator runs you will need to register your Twitter application for OAuth at http://twitter.com/oauth_clients, 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"
class User < TwitterAuth::GenericUser
def refresh_twitter_attributes!
update_twitter_attributes(twitter.get('/account/verify_credentials'))
end
end
# OptionsProxy creates a proxy object with attribute accessors
# and defaults.
options = OptionsProxy.new(:fancy, :name, {
:fancy => true
})
options.fancy # => true
options.name # => nil