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 Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| for (int i = 0; i < 30; i++) { | |
| __block __weak id ob1 = nil; | |
| __block __weak id ob2 = nil; | |
| void (^block)(NSNotification *) = ^(NSNotification *note) { | |
| NSLog(@"got noti %@, ob1: %@, ob2: %@", note.name, ob1, ob2); | |
| [[NSNotificationCenter defaultCenter] removeObserver:ob1]; | |
| [[NSNotificationCenter defaultCenter] removeObserver:ob2]; | |
| }; | |
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
| #ifdef DEBUG | |
| //Lumberjack | |
| DDTTYLogger *log = [DDTTYLogger sharedInstance]; | |
| // we also enable colors in Xcode debug console | |
| // because this require some setup for Xcode, commented out here. | |
| // https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/XcodeColors | |
| [log setColorsEnabled:YES]; */ | |
| [log setForegroundColor:[UIColor orangeColor] backgroundColor:nil forFlag:LOG_FLAG_INFO]; | |
| [log setForegroundColor:[UIColor redColor] backgroundColor:nil forFlag:LOG_FLAG_ERROR]; |
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
| " copy all this into a vim buffer, save it, then... | |
| " source the file by typing :so % | |
| " Now the vim buffer acts like a specialized application for mastering vim | |
| " There are two queues, Study and Known. Depending how confident you feel | |
| " about the item you are currently learning, you can move it down several | |
| " positions, all the way to the end of the Study queue, or to the Known | |
| " queue. | |
| " type ,, (that's comma comma) |
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
| import sublime, sublime_plugin, os | |
| class ExpandSelectionToDelimsCommand(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| begindelims = ["\"", "\'", "(", "<", "[", "{"] | |
| enddelims = ["\"", "\'", ")", ">", "]", "}"] | |
| view = self.view | |
| oldSelRegions = list(view.sel()) | |
| for thisregion in oldSelRegions: | |
| thisRegionBegin = thisregion.begin() - 1 |
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
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rbenv' # for rbenv support. (http://rbenv.org) | |
| # require 'mina/rvm' # for rvm support. (http://rvm.io) | |
| # Basic settings: | |
| # domain - The hostname to SSH to. | |
| # deploy_to - Path to deploy into. | |
| # repository - Git repo to clone from. (needed by mina/git) |
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
| #!/bin/bash | |
| # from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
| # and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
| ############################################### | |
| # To use: | |
| # wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh | |
| # chmod 777 install-redis.sh | |
| # ./install-redis.sh | |
| ############################################### | |
| echo "*****************************************" |
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
| #!/bin/bash | |
| # from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
| # and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
| ############################################### | |
| # To use: | |
| # wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh | |
| # chmod 777 install-redis.sh | |
| # ./install-redis.sh | |
| ############################################### | |
| echo "*****************************************" |
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
| #!/bin/sh | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| TIMEOUT=${TIMEOUT-60} | |
| APP_ROOT=/u/apps/the_app/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb" |
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
| # Sample verbose configuration file for Unicorn (not Rack) | |
| # | |
| # This configuration file documents many features of Unicorn | |
| # that may not be needed for some applications. See | |
| # http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb | |
| # for a much simpler configuration file. | |
| # | |
| # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
| # documentation. |