This file contains hidden or 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
Sublime tricks | |
You probably know some of these tricks, but hopefully you don't know them all. | |
File navigation | |
* Quick open (cmd + t) | |
* Quick open with symbols | |
* Quick open peek |
This file contains hidden or 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
def b(n, &block) | |
puts "start: #{n}" | |
if block_given? | |
puts yield | |
end | |
puts "stop" | |
end | |
def a(&block) | |
b(1, &block) |
This file contains hidden or 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
class RidesIndexParamValidation | |
MAX_LIMIT = 200 | |
attr_reader :result, :failure_details | |
def initialize(params) | |
@params = params | |
@result = :unspecified | |
end |
This file contains hidden or 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
class Result | |
attr_reader :failure_details | |
def initialize(successful, failure_details = nil) | |
@failure_details = failure_details | |
end | |
def failure? | |
@failure_details != nil | |
end |
This file contains hidden or 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 strict" | |
# Classico lib - go down for examples | |
Classico = {} | |
Classico.prototype = | |
super: (propertyName) -> | |
Object.getPrototypeOf(Object.getPrototypeOf(@))[propertyName].call @ | |
Classico.include = (hash) -> |
This file contains hidden or 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
# Wingman is a yet to be released coffeescript MVC framework. Throughout Wingman, WingmanObject is | |
# used for monitoring changes to a object in real time in various handy ways. | |
# The simplest use of #observe is like this: | |
o = new WingmanObject | |
o.set name: 'Ras' | |
o.observe 'name', -> alert 'cb fired!' | |
o.set name: 'Yogi' |
This file contains hidden or 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 snippet was inspired by | |
# http://www.igvita.com/2010/04/15/non-blocking-activerecord-rails/ | |
require 'fiber' # needed to use Fiber.current | |
require 'rubygems' | |
require 'mysqlplus' | |
require 'eventmachine' | |
require 'em-mysqlplus' | |
def query(sql) |