Skip to content

Instantly share code, notes, and snippets.

View sommestad's full-sized avatar

Kristofer Sommestad sommestad

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sommestad on github.
  • I am esset (https://keybase.io/esset) on keybase.
  • I have a public key whose fingerprint is D327 57AB 8150 64B3 006E 4870 2E49 AF3E 50B6 7FC9

To claim this, I am signing this object:

@sommestad
sommestad / npm-release.sh
Created October 12, 2015 13:59
NPM: Release new version
#!/bin/sh
#############################################
# Run from the directory of the NPM module #
#############################################
VERSION_TYPE=$1
if [ -z "$VERSION_TYPE" ]; then
echo "Usage: ./npm-release.sh <major|minor|patch>";
@sommestad
sommestad / API.md
Last active October 7, 2015 09:02 — forked from potmo/test.md
A basic test for client developers.
@sommestad
sommestad / monkey-cage-test.js
Last active August 29, 2015 14:22
Experimental alternatives to Dependency Injection in Javascript
'use strict';
require('chai').should();
var sinon = require('sinon');
var cage = require('./monkey-cage.js');
describe(__filename, function() {
describe('openCage', function() {
@sommestad
sommestad / 5-whys.js
Last active August 29, 2015 14:02
The Five Whys.
/**
* The Five Whys.
* @see http://en.wikipedia.org/wiki/5_Whys
* @param {Object} person Whodat?
* @param {Object} thing What I'm thinking of doing.
*/
function isItTheRightThingToDo(person, thing) {
for (var i = 0; i < 5; i++) {
if (person.hasActualAnswer(thing)) {
return true;
@sommestad
sommestad / xcode-version-bump.sh
Created May 2, 2013 12:43
Increments CFBundleVersion when archiving the app. Still requires changing version number manually when making archives for submit. (Courtesy of https://gist.github.com/sekati/3172554; I just adjusted it to set CFBundleVersion, which I find more useful).
# xcode-version-bump.sh
# @desc Auto-increment the version number (only) when a project is archived for export.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Check the checkbox "Run script only when installing"
# 6. Drag the "Run Script" below "Link Binaries With Libraries"
# 7. Insure your starting version number is in SemVer format (e.g. 1.0.0)
@sommestad
sommestad / gist:1909096
Created February 25, 2012 15:32
Moving a playlist to a folder.
if (_appFolder) {
NSArray * containerPlaylists = container.playlists;
for (SPPlaylist * containerPlaylist in containerPlaylists) {
// move all playlists tagged with SpotON Radio:
if ([containerPlaylist.name rangeOfString: kPlaylistNameMatch].location != NSNotFound) {
NSInteger playlistIndex = [[container playlists] indexOfObject: containerPlaylist];
DLog(@"-> MOVE playlist %@ at index %i", containerPlaylist.name, playlistIndex);