Skip to content

Instantly share code, notes, and snippets.

View mnem's full-sized avatar

Dave Clayton-Wagner mnem

View GitHub Profile
@mnem
mnem / NSMutableArray+Shuffle.h
Created August 19, 2011 12:44
NSMutableArray category for Fisher–Yates style shuffling. See http://en.wikipedia.org/wiki/Fisher–Yates_shuffle
/**
* NSMutableArray+Shuffle.h
*
* (c) Copyright 2011 David Wagner.
*
* Complain/commend: http://noiseandheat.com/
*
*
* Licensed under the MIT license:
*
@mnem
mnem / heterogenous.swift
Created August 30, 2017 18:43
Decoding values from silly heterogenous JSON arrays.
//: Playground - noun: a place where people can play
import Foundation
let json = """
[
{"person":{"name":"foo", "age":20}},
{"house":{"size":"large"}}
]
""".data(using: .utf8)!
@mnem
mnem / alias_pbcopy_pbpaste.sh
Created December 7, 2011 16:35
pbcopy and pbpaste for linux
# Emulate pbcopy and pbpaste for copying to and from the pasteboard/clipboard
#
# via: http://whereswalden.com/2009/10/23/pbcopy-and-pbpaste-for-linux/
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
@mnem
mnem / README.md
Last active January 3, 2017 09:14
Influence Maps
@mnem
mnem / nah_vpn_add_user.sh
Created January 17, 2012 13:32
Simple script to add VPN users to your chap-secrets file. For details on setting up a VPN on EC2, see http://noiseandheat.com/blog/2012/01/vpn-with-amazon-ec2-or-saving-your-iphone-from-promiscuity/
#!/bin/bash
#######################################
# Simple script to add VPN users to your chap-secrets file. For details
# on setting up a VPN on EC2, see:
#
# http://noiseandheat.com/blog/2012/01/vpn-with-amazon-ec2-or-saving-your-phone-from-promiscuity/
#
#
# (c) Copyright 2011 David Wagner.
#
@mnem
mnem / install_all_the_things.sh
Last active September 7, 2016 21:03
Things to install on a fresh Mac: bash <(curl -fsSL https://gist.github.com/mnem/6560977/raw/install_all_the_things.sh)
#!/usr/bin/env bash
function execute_after_confirm {
read -p "$1 ($2) ? [y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
shift
for var in "$@"
do
@mnem
mnem / Main.as
Last active December 17, 2015 08:28
Not sure if bug, or just user error.
package
{
import ash.core.Engine;
import ash.core.Entity;
import flash.display.Sprite;
public class Main extends Sprite
{
@mnem
mnem / CommandConnection.as
Created April 24, 2013 17:51
Simple local TCP line command listener thungumy.
/**
* Copyright
*/
package org.tryharder.levelup2013
{
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.ServerSocketConnectEvent;
import flash.net.ServerSocket;
import flash.net.Socket;
function foo()
if bingle
if bangle
if bongle
do
some
really
really
really
long
@mnem
mnem / .gitignore
Created November 15, 2012 10:26
Simple test to illustrate a small audio latency in the PPAPI version of the Flash plugin in Chrome.
.DS_Store