⌘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 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
#!/usr/bin/python | |
#usage python show.py <local_port> | |
''' | |
Taken from: https://gist.github.com/932137 (found in http://news.ycombinator.com/item?id=2467107 ) | |
Let's say you have a webapp running in localhost (with `manage.py runserver` in django or `ruby script.rb` in sinatra or `rails server` or whatever) and you want others to be able to see it with a public url without deploying remotely. | |
ssh provides a neat facility for that: tunneling. You set up a "tunnel" from the remote host to yours and vice-versa and then you give the remote host's url and it will send all of its requests to your local daemon. |
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 MethodCop | |
# Guard methods that have side effects with a callback that fires before the method is invoked. | |
# If the callback returns a "falsey" value, the method is halted and will not be called. | |
# The callback will return nil instead. | |
# if the method does not have side effects or you depend on its return value, you should NOT | |
# use this on that method! This will break the _hell_ out of design by contract. | |
# currently does not work with methods that accept blocks so be aware of that. Fixes, improvements, | |
# pull requests, and general "why on earth did you do this" notes are encouraged. | |
#TODO: DRY this up |
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 LikeRuby | |
VALLEYGIRL = %w[omg so like totally right toootally stuff] | |
FRATGUY = %w[friggin fuckin dude man bro broheim broseph] | |
INTERNETS = %w[lol rofl teh ohai plz] | |
SNOOP = %w[yo homey homeboy sup dog shit girl ma biatch ho shiiit] | |
LOCAL = %w[wicked hella anyways] | |
MISC = %w[just hey yeah ok um uh ah actually something] | |
ALLSLANG = VALLEYGIRL + FRATGUY + INTERNETS + SNOOP + LOCAL + MISC | |
def method_missing(name, *args) |
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
var generateRandomBoxes = function() { | |
var $doc = $(".container"); | |
var $bareBox = $("<div class='box' style='position:absolute; border:1px solid black; width:50px;'></div>"); | |
var maxHeight = 200; | |
var height, | |
$box; | |
for (var i = 0; i < 100; i++) { | |
height = Math.floor(Math.random() * maxHeight); | |
$box = $bareBox.clone().css('height', height + 'px') |
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.directive('ngEnter', function() { | |
return function(scope, element, attrs) { | |
element.bind("keydown keypress", function(event) { | |
if(event.which === 13) { | |
scope.$apply(function(){ | |
scope.$eval(attrs.ngEnter); | |
}); | |
event.preventDefault(); | |
} |
Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
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
:+1: | |
:-1: | |
:airplane: | |
:art: | |
:bear: | |
:beer: | |
:bike: | |
:bomb: | |
:book: | |
:bulb: |
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
// Usage: | |
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread | |
// then use as follows: | |
// | |
// query(term | [term, term, ...], term | [term, term, ...], ...) | |
// | |
// When arguments are in an array then that means an "or" and when they are seperate that means "and" | |
// | |
// Term is of the format: | |
// ((-)text/RegExp) ( '-' means negation ) |
OlderNewer