Skip to content

Instantly share code, notes, and snippets.

@capnslipp
capnslipp / SCNViewController.swift
Last active September 18, 2016 01:49
An adaptable UIViewController subclass for SceneKit
/// @creator: Slipp Douglas Thompson
/// @license: WTFPL
/// @purpose: A `UIViewController` subclass (instantiable from code or XIB/Storyboard) that initializes its `SCNView` using the specified `viewFrame` & `viewOptions`.
/// @why: Because this functionality should be built-into SceneKit.
/// @usage: _FILL_IN_
/// @interwebsouce: https://gist.github.com/capnslipp/6d3e4d3a5f0aeb96eda416774e22dd1f
import UIKit
import SceneKit
@capnslipp
capnslipp / GlobalsStruct.swift
Last active July 23, 2016 00:32
Swift struct private init() test
public struct GlobalsStruct {
public static let aValue = 5
private init() {}
}
@capnslipp
capnslipp / gist:8552399
Created January 22, 2014 02:17
C# modifier syntax wishlist
struct Plainy
{
public:
readonly:
int foo;
int bar;
}
static class Clingy
slippyd@silverdelicious:~$ cd Desktop/
# cloning git repo from github:
slippyd@silverdelicious:~/Desktop$ git clone git@github.com:capnslipp/p001.git p001_git
Cloning into 'p001_git'...
remote: Counting objects: 3360, done.
remote: Compressing objects: 100% (870/870), done.
remote: Total 3360 (delta 2407), reused 3331 (delta 2380)
@capnslipp
capnslipp / pre-push
Created October 3, 2013 23:55
Standard project .git/hooks/pre-push This pre-push hook (which I use for many of my projects) skips pushing branches and tags that start with “wip/”, “tmp/”, or “local/”. This makes it easy to keep commits marked as work-in-progress, temporary, or local-only from leaking upstream. Requires git 1.8.2, in which pre-push hooks were introduced.
#!/bin/sh
#
# Hook script that blocks pushing of branches and tags with the form 'wip/*', and commits commits the log message starts
# with "WIP" (work in progress)..
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
@capnslipp
capnslipp / Current Block Syntax.m
Last active December 19, 2015 19:09
Brainstorming a more Obj-C-like block syntax
double (^multiplyTwoValues)(double, double) = ^(double firstValue, double secondValue) {
return firstValue * secondValue;
};
double result = multiplyTwoValues(2, 4);
// or
typedef double (^CombineTwoValuesBlock)(double firstValue, double secondValue);
@capnslipp
capnslipp / lsregister-remove
Created July 5, 2013 04:07
Removes applications from OS X's filetype association database (LaunchServices).
#!/usr/bin/env bash
# @purpose: Removes applications from OS X's filetype association database (LaunchServices).
# Useful for .apps you'd like around but never want automatically launched. I use it for alpha/beta/developer preview versions that I like to play with, but don't want to commit to yet.
lsregister="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister" # or `locate -l1 lsregister`
argc=$#
if [ $argc -ne 1 ]; then
scriptname=`basename $0`
@capnslipp
capnslipp / install_dependencies.sh
Last active December 18, 2015 17:49 — forked from kaspermunck/install_dependencies.sh
Quotes. I like quotes. Also, I like accurate constant identifiers. Imagine that.
#!/bin/bash
# run prior to building with XcodeTest to install WaxSim.
# @note: assumed that WaxSim is already present in the repo at WAXSIM_PATH
# I recommend installing a submodule (rather than including WaxSim's source in the repo itself) via something to the effect of `git submodule add git@github.com:jonathanpenn/WaxSim.git Tools/WaxSim`. But you're free to do whatever you want.
WAXSIM_PATH=./Tools/WaxSim/
# install waxsim
cd "$WAXSIM_PATH"
xcodebuild install DSTROOT=/ INSTALL_PATH=/usr/local/bin
@capnslipp
capnslipp / ViewController.m
Created May 13, 2013 05:52
Quick test to find out what happens if an NSMutableArray is changed significantly within a for…in loop. (Modified from the ViewController.m from Xcode's iOS Single View Application project template.)
//
// ViewController.m
// LoopErrorTest
//
// Created by Slipp D. on 5/13/13.
// Copyright (c) 2013 me!. All rights reserved.
//
#import "ViewController.h"
@capnslipp
capnslipp / ActivityMonitor sample text
Created February 16, 2013 20:57
Finder ballin' (2012-02-16)
This file has been truncated, but you can view the full file.
Sampling process 84871 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Finder (pid 84871) every 1 millisecond
Process: Finder [84871]
Path: /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
Load Address: 0x1035a3000
Identifier: com.apple.finder
Version: 10.8.1 (10.8.1)
Build Info: Finder_FE-808001006000000~2
Code Type: X86-64 (Native)