⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
# Option 1 | |
class SomeController extends Batman.Controller | |
index: -> | |
# Do some stuff | |
view = @render() | |
view.on 'ready', -> | |
# The view's HTML is now in the DOM, ready for jQuerying. | |
# To make your jQuery selectors faster, you can use the second argument of `$` and | |
# pass in the view's node as the node to search for your selector within |
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 Shopify.OrdersController extends Shopify.ApplicationController | |
index: (params) -> | |
@allOrders = Shopify.Order.get('all') | |
@_filterOrders() | |
addFilter: (type, value) -> | |
@set "#{type}Filter", value | |
@_filterOrders() | |
_filterOrders: -> |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
I wrote this up here: http://blog.steveklabnik.com/posts/2012-02-27-hypermedia-api-reading-list
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
events = | |
events: {} | |
bind: (topic, handler, context = this) -> | |
(@events[topic] ||= []).push { handler, context } | |
trigger: (topic, args...) -> | |
if @events[topic]? | |
event.handler.apply event.context, args for event in @events[topic] |
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
-- Haversine Formula based geodistance in miles (constant is diameter of Earth in miles) | |
-- Based on a similar PostgreSQL function found here: https://gist.github.com/831833 | |
-- Updated to use distance formulas found here: http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe | |
CREATE OR REPLACE FUNCTION public.geodistance(alat double precision, alng double precision, blat double precision, blng double precision) | |
RETURNS double precision AS | |
$BODY$ | |
SELECT asin( | |
sqrt( | |
sin(radians($3-$1)/2)^2 + | |
sin(radians($4-$2)/2)^2 * |
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
task 'sample_task', sample_task = (callback) -> | |
doSomethingAndRunCallbackAfter callback | |
task 'setup', 'All: Import all data and run webserver', -> | |
tasks = [install, pre_populate, populate_couch, graph_sync, server] | |
runSequentially = (currentTask, otherTasks...) -> | |
currentTask -> | |
if otherTasks.length | |
runSequentially otherTasks... | |
runSequentially tasks... |
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
/* | |
node --max_old_space_size=3000 --prof nodemem.js | |
# --trace_incremental_marking=true --incremental_marking_steps=false | |
node --max_old_space_size=3000 --max_new_space_size=3000 --max_executable_size=1000 --gc_global --prof nodemem.js | |
# --noincremental_marking | |
# --nolazy_sweeping | |
# --never_compact |