Skip to content

Instantly share code, notes, and snippets.

View jamesnesfield's full-sized avatar

James Nesfield jamesnesfield

View GitHub Profile
@jamesnesfield
jamesnesfield / iOS-Example.m
Created December 19, 2018 11:18
ios-example
/*------------------------------------------------------------------------------
* Initialise the SDK with your Chirp app key and secret
* (configured in Licence.h)
*----------------------------------------------------------------------------*/
self.connect = [[ChirpConnect alloc] initWithAppKey:CHIRP_APP_KEY
andSecret:CHIRP_APP_SECRET];
NSLog(@"%@", [self.connect version]);
NSError *error = [self.connect setConfig:CHIRP_APP_CONFIG];
@jamesnesfield
jamesnesfield / chirp-offline.m
Last active February 15, 2016 11:37
iOS Getting Started
[[ChirpSDK sdk] setOfflineOnly:YES];
[[ChirpSDK sdk] startListening:^(Chirp *chirp, NSError *error)
{
NSLog(@"Heard chirp: %@", chirp.shortcode);
}];
// cant remember where i got this from, not my code though
- (void)setSoundNamed:(NSString *)name forControlEvent:(UIControlEvents)controlEvent
{
// Remove the old UI sound.
NSString *oldSoundKey = [NSString stringWithFormat:@"%lu", (unsigned long)controlEvent];
AVAudioPlayer *oldSound = [self sounds][oldSoundKey];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wselector"
@jamesnesfield
jamesnesfield / gh-pages-deploy.md
Created November 13, 2015 23:04 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@jamesnesfield
jamesnesfield / nice-gradient.css
Created October 29, 2014 17:28
nice gradient
.nice-gradient {
background-image: linear-gradient(160deg,#63D663 20%,#57D39C 80%);
}
#!/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")
@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
@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 / 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 <solomon@dotcloud.com>
add . /app
run /buildpack/bin/compile /app /tmp
cmd ["sh", "-c", "PORT=5000 /app/bin/node /app/web.js"]
expose 5000
@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