Skip to content

Instantly share code, notes, and snippets.

View mtcmorris's full-sized avatar

Michael Morris mtcmorris

  • Melbourne, Australia
View GitHub Profile
@mtcmorris
mtcmorris / gist:28f370c327c29a06086b
Created August 24, 2014 02:38
Rails Girls Melbourne
$.benchmarkStart = function(message, timer) {
timers[timer] = new Date().getTime();
$("#debugstatus").append("<p>Starting: " + message + "</p>");
}
$.benchmarkFinish = function(message, timer) {
var timesince = new Date().getTime() - timers[timer];
$("#debugstatus").append("<p>Finished: " + message + ". " + timesince + "msec</p>");
}
var timers = {};
# Getting everything setup
babushka benhoskings:'webserver configured.managed'
babushka 'benhoskings:vhost configured.nginx'
# Utils
babushka 'benhoskings:libxslt.managed'
babushka 'benhoskings:imagemagick.managed'
babushka benhoskings:coffeescript.src
@mtcmorris
mtcmorris / lion-libpng
Created July 30, 2011 01:24
Fix lion libpng
Fixing Lion libpng issues
-------------------------
Until this issue https://github.com/mxcl/homebrew/issues/4468 is resolved installing Lion screws up ImageMagick's png support. The following steps are a hacky work around to get things going again. `identify: memory allocation failed` is the error message you'll receive before applying the fix.
brew uninstall imagemagick
cd /usr/X11R6/lib
sudo mv libpng.dylib libpng.old.dylib
sudo ln -s libpng12.0.dylib libpng.dylib
brew install imagemagick
@mtcmorris
mtcmorris / gist:1194204
Created September 5, 2011 06:06
Mustaches for everyone!!
<% if current_user_is_editor? %>
<%= content_for :footer do %>
<script type="text/javascript">
$(document).ready(function() {
$("article.vcard img").each(function(index, img) {
$(img).attr("src", "http://mustachify.me/?src=" + "http://theconversation.edu.au" + $(img).attr("src"));
});
});
</script>
<% end %>
@mtcmorris
mtcmorris / gist:1300214
Created October 20, 2011 01:48
dm belongs_to key problem
require 'dm-core'
require 'dm-migrations'
require 'dm-validations'
DataMapper.setup :default, "sqlite::memory"
class User
include DataMapper::Resource
property :id, Serial
has 1, :image
@mtcmorris
mtcmorris / gist:1392860
Created November 25, 2011 05:18
DM AR diff
@@ -138,29 +138,12 @@ class Content < ActiveRecord::Base
)
end
- # DataMapper made me do it, sorry baby Jesus.
- def self.search(keywords, options = {})
- options = {
- conditions: ["true"]
- }.merge(options)
-
@mtcmorris
mtcmorris / gist:1813634
Created February 13, 2012 04:18
link checker styles
a.checking {
@include rounded(2px);
color: #bbb;
border-bottom:1px dotted #bbb;
font-size: 15px;
line-height: 16px;
position: relative;
&:before {
position: absolute;
@mtcmorris
mtcmorris / gist:3082609
Created July 10, 2012 10:42
20 top films in the past 5 years
The Artist
Senna
Hanna
Headhunters (Hodejegerne)
The Help
Best Exotic Marigold Hotel
District 9
Crazy Stupid Love
The Social Network
Black Swan
@mtcmorris
mtcmorris / gist:4037500
Created November 8, 2012 08:15
Just beat it.
@-webkit-keyframes pulse {
0% { font-size: 1em; }
30% { font-size: 1em; }
35% { font-size: 1.4em; }
40% { font-size: 1em; }
50% { font-size: 1em; }
55% { font-size: 1.4em; }
60% { font-size: 1em; }
100% { font-size: 1em; }
}