Skip to content

Instantly share code, notes, and snippets.

View jamesnesfield's full-sized avatar

James Nesfield jamesnesfield

View GitHub Profile
@jamesnesfield
jamesnesfield / appdelegate_macro
Created March 17, 2014 11:55
A macro for the appdelegate
#define APP_DELEGATE ((AppDelegate *)[[UIApplication sharedApplication] delegate])
@jamesnesfield
jamesnesfield / UIImage+Screenshot.h
Created March 19, 2014 10:52
screenshots for iOS 7 as a UIImage category
@interface UIImage (Screenshot)
+ (UIImage *)screenshot;
@end
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
var mongoose = require('./db-connect'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
uuid = require('node-uuid'),
Validator = require('validator').Validator,
val = new Validator(),
bcrypt = require('bcrypt');
Validator.prototype.error = function(msg) { return false; };
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@jamesnesfield
jamesnesfield / index.jade
Created August 27, 2014 00:13
A Pen by James Nesfield.
body
div.panel#one
div.panel#two
div.panel#three
div.panel#four
h4 color elements
a(href="google.com")
h3 download
@jamesnesfield
jamesnesfield / Dockerfile
Last active August 29, 2015 14:05
dockerise heroku node app
//from https://github.com/shykes/vr_node_example/blob/master/Dockerfile
from heroku/heroku-buildpack-nodejs
maintainer Solomon Hykes <[email protected]>
add . /app
run /buildpack/bin/compile /app /tmp
cmd ["sh", "-c", "PORT=5000 /app/bin/node /app/web.js"]
expose 5000
@jamesnesfield
jamesnesfield / build_number_increment_xcode_build
Created October 5, 2014 16:16
increment xcode build number for each build/run
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@jamesnesfield
jamesnesfield / screenshot_timelapse
Last active August 29, 2015 14:07
[mac] take a screenshot every minute during the techcrunch hackathon - for audit and awesomeness - and to make a nice timelapse video afterwards.
## OPEN OSX'S "SCRIPT EDITOR" APP AND PASTE ME IN, OR USE "SCRIPT EDITOR" TO SAVE ME AS A PROPER APP :)
tell application "Finder"
repeat with ii from 0 to 1440
set sc to "/usr/sbin/screencapture \"" & POSIX path of (path to desktop as string) & "TC_hack_" & (current date) & ".png\""
do shell script sc
delay 60
end repeat
end tell
#!/usr/bin/ruby
if ARGV.empty?
puts "Usage: ruby make-new-post.rb SLUG"
exit
end
POST_DIR = "/PATH/TO/YOUR/DEAL" # no trailing slash
date = Time.now.strftime("%Y-%m-%d")