This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this_file = Regexp.new(__FILE__) | |
# Capture every single time an exception is raised in this Ruby program. | |
# Use TracePoint for Ruby 2.0+, set_trace_func for Ruby 1.9- | |
trace = TracePoint.new(:raise) do |tp| | |
exception = tp.raised_exception | |
backtrace = exception.backtrace | |
# if the source of the error is in this file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.handlers.employees = Ember.Object.create({ | |
add: function() { | |
App.viewables.newEmployee.reset(); | |
App.viewables.employeeFormPane.set('adding', true); | |
}, | |
cancel: function() { | |
App.viewables.employeeFormPane.set('adding', false); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This extends the behavior of Rake to allow you to see all of the dependencies | |
# of a Rake task recursively, not just the immediate dependencies. | |
# | |
# It adds a -d option (also called --dependency-tree). Left blank, this | |
# option shows you dependencies for all Rake tasks. Alternatively, you | |
# can pass a regular expression to this option and it will only show | |
# dependencies for matching tasks. | |
# | |
# To use this special version of Rake, save it in a Ruby file called | |
# raketree.rb (but the name really doesn't matter). Here are some examples of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This code has graduated from a gist to a gem! | |
http://gemcutter.org/gems/rack-linkify | |
http://github.com/techiferous/rack-linkify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you'd like this packaged up as a gem, send me a note. You can get | |
# in touch with me at http://www.techiferous.com/about | |
require 'nokogiri' | |
require 'ispell' | |
module Rack | |
class SpellCheck | |
def initialize(app, options = {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
module Rack | |
class Steamroller | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This code has graduated from a gist to a gem! | |
http://gemcutter.org/gems/rack-gsub | |
http://github.com/techiferous/rack-gsub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class EtyRack | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
sleep 86400 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class Lockdown | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
if ["GET", "HEAD"].include?(request.request_method) |
NewerOlder