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
#!/bin/sh | |
# set the strict mode | |
set -e | |
if [ -d "/Volumes/Thumbdrive" ]; then | |
if [ ! -d "/Volumes/Thumbdrive/Backups" ]; then | |
mkdir "/Volumes/Thumbdrive/Backups" | |
fi |
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
# encoding: utf-8 | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64.box" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
# config.vm.box = "opscode-ubuntu-12.04_chef-11.4.0" |
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
#!/bin/sh | |
# Based On: https://github.com/chovy/node-startup/blob/master/init.d/node-app | |
# strict | |
set -e | |
NODE_ENV="development" | |
NODE_APP='app.js' | |
APP_DIR='.'; |
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 Promise = require('promise'); | |
// Always return a promise for immediate or delayed responses | |
var doAsync = function(nbr) { | |
if (nbr === 1) { | |
// use static function to resolve with data immediately | |
return Promise.resolve('Success already!'); | |
} | |
else if (nbr === 2) { | |
// use static function to reject with an error immediately |
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 Promise = require('promise'); | |
var limit = 3; | |
var doAsync = function(nbr) { | |
var promise = new Promise(function (resolve, reject) { | |
setTimeout(function() { | |
if (nbr <= limit) { | |
// increment the given value by 1 | |
resolve(nbr+1); |
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
{ | |
"name": "promise-sample", | |
"description": "Promise Sample", | |
"version": "0.0.1", | |
"private": true, | |
"dependencies": { | |
"promise": "~4.0.0" | |
} | |
} |
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
#!/bin/sh | |
RUBY=`which ruby` | |
if [[ $RUBY = '/usr/bin/ruby' ]] ; then | |
echo "error: You must run the following command from the command-line." | |
echo "sudu gem pod install" | |
else | |
if [[ -e 'Podfile' ]]; then | |
gem pod install |
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
#!/bin/sh | |
// What The Archive! | |
// The argument passed in should be the Xcode project name so it can find and run lipo on each archive to | |
// look for each of the supported architectures to help the developer see what is there and what is missing. | |
// It looks in the DerivedData folder for the most recent matching folder using the given project name. | |
PROJECT_NAME=$1 | |
BASE_DIR=~/Library/Developer/Xcode/DerivedData/ |
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
- (NSIndexPath *)indexPathForView:(UIView *)view inTableView:(UITableView *)tableView { | |
UIView *superview = view; | |
while (superview && ![superview isKindOfClass:[UITableViewCell class]]) { | |
superview = superview.superview; | |
} | |
if ([superview isKindOfClass:[UITableViewCell class]]) { | |
NSIndexPath *indexPath = [tableView indexPathForCell:(UITableViewCell *)superview]; | |
return indexPath; | |
} |
OlderNewer