Skip to content

Instantly share code, notes, and snippets.

View mgauthier's full-sized avatar

Michael Gauthier mgauthier

  • Toronto, Ontario
View GitHub Profile
@mgauthier
mgauthier / unicorn_logging.rb
Created May 20, 2011 19:25
Rails w/ Unicorn: Log to console
#Put this in application.rb, or in a rake task initialize code
if defined?(Rails) && (Rails.env == 'development')
Rails.logger = Logger.new(STDOUT)
end
@mgauthier
mgauthier / gist:1435223
Created December 5, 2011 20:31
Button with Gradient CSS
.button-container {
width:100%;
}
.button-container.right {
text-align:right;
}
a.button {
display:block;
@mgauthier
mgauthier / image_fit.js
Created December 19, 2011 21:31
Image centering js
function fitImage(image_container, image_url, el, callback) {
//hide image until loaded
$(image_container,el).html('<img src="'+image_url+'"/>');
var image = $(image_container+' img',el);
$(image,el).css({
'display':'none'
})
//set a spinner animation in the background of the container
@mgauthier
mgauthier / missing_test.rb
Created November 16, 2012 22:20
Missing model and controller tests script
type = ARGV[0]
types = ["model", "controller"]
def strip_down_filename(f,token)
f.split("/").last.gsub("#{token}.rb","")
end
if !type || !types.include?(type)
puts "Usage: 'ruby missing_tests.rb [ model|controller ]'"
else