Skip to content

Instantly share code, notes, and snippets.

View ubermajestix's full-sized avatar

Tyler Montgomery ubermajestix

View GitHub Profile
@ahoward
ahoward / routes.rb
Created December 5, 2011 15:55
scope gives cleaner routes compared to nested resources
class Acccount
def to_param
slug
end
end
# Automatically add mustaches to any images it can
#
#
module.exports = (robot) ->
robot.hear /^(https?:\/\/[^ #]+\.(?:png|jpg|jpeg))(?:[#]\.png)?$/i, (msg) ->
src = msg.match[1]
unless src.match(/^http:\/\/mustachify.me/)
msg.http("http://stacheable.herokuapp.com")
# a little wrapper on yaml/store to give collection and record access to a
# transaction yaml store.
#
# sample usage
#
# require 'ydb'
#
# db = Db.new
#
# collection = db.collection(:posts)
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@zerowidth
zerowidth / paginated_collection.js
Created November 18, 2010 22:04
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");
class A
def implicit_block_implicit_ensure
begin
"block"
ensure
"ensure"
end
end
def implicit_block_explicit_ensure