Skip to content

Instantly share code, notes, and snippets.

@steverichey
steverichey / gist:5100082
Created March 6, 2013 15:28
A copy of the Defaults.XML file.
<?xml version="1.0" encoding="utf-8" ?>
<data>
<display>
<time x="468" y="1" /> <!-- defaults: 474, -1 -->
<splash x="69" y="94" /> <!-- defaults: 69, 94 -->
<about x="4" y="26" okayx="361" okayy="191" /> <!-- defaults: 4, 26, 361, 191 -->
<instructions x="20" y="27" okayx="180" okayy="269" /> <!-- defaults: 20, 27, 180, 269 -->
<setendscore x="75" y="45" okayx="122" okayy="67" cancelx="46" cancely="71" /> <!-- defaults: 75, 45, 122, 67, 46, 71 -->
<scorewarning x="-42" y="13" okayx="248" okayy="29" /> <!-- defaults: -42, 13, 248, 29 -->
<scoreinput x="154" y="28" width="35" height="30" restrict="1234567890" maxchars="3" /> <!-- defaults: 154, 28, 35, 30, 1234567890, 3 -->
@steverichey
steverichey / Fullscreen FlxGame
Created December 18, 2013 18:53
The FlxGame class from my update to Gama11's MinimalistTD, demonstrating fullscreen resize code.
package;
import flash.events.Event;
import flash.Lib;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxCamera;
class GameClass extends FlxGame
{
@steverichey
steverichey / SequenceType+Multifilter.swift
Created April 21, 2016 17:36
A Swift extension to perform two filters simultaneously.
extension SequenceType {
/**
Filter a single sequence into two "buckets", each an array containing objects of this collection's element type.
- parameter includeElementInFirstCollection: A method that returns true for elements to include in the first collection.
- parameter includeElementInSecondCollection: A method that returns true for elements to include in the second collection.
- returns: A tuple of two arrays containing the elements in their respective buckets.
*/
@warn_unused_result
public func multifilter(@noescape includeInFirst includeElementInFirstCollection: (Self.Generator.Element) throws -> Bool, @noescape includeInSecond includeElementInSecondCollection: (Self.Generator.Element) throws -> Bool) rethrows -> ([Self.Generator.Element], [Self.Generator.Element]) {
var firstCollection: [Self.Generator.Element] = []
@steverichey
steverichey / csv_to_bitmap.swift
Created June 28, 2016 16:40
Convert CSV of luminance to PNG
// swiftlint:disable line_length
// swiftlint:disable variable_name
import Foundation
import Cocoa
struct PixelData {
var a: UInt8 = 255
var r: UInt8
var g: UInt8
@steverichey
steverichey / egg.py
Created August 8, 2016 01:44
Automatic egg hatcher for Egg, Inc.
# Save as `egg.py`
# Run with `monkeyrunner egg.py`
# Must have Android SDK `tools` directory in your PATH
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyView
device = MonkeyRunner.waitForConnection()
# These will vary depending on your device!
x = 720
@steverichey
steverichey / keybase.md
Created October 7, 2016 00:29
keybase.md

Keybase proof

I hereby claim:

  • I am steverichey on github.
  • I am steverichey (https://keybase.io/steverichey) on keybase.
  • I have a public key whose fingerprint is 516B 6908 5CE8 D147 B985 5E42 9011 2DDB F6AB F744

To claim this, I am signing this object:

@steverichey
steverichey / SafeFloat.js
Created April 21, 2015 18:15
An Ember helper that prevents user-facing NaN values.
/**
* Prevents displaying NaN to the user. Defaults to 0.
*/
Ember.Handlebars.helper("safefloat", function(value, options) {
if (Ember.isEmpty(value) || isNaN(value)) {
value = 0;
}
return new Ember.Handlebars.SafeString(value);
});
@steverichey
steverichey / eject_trash_images.py
Last active December 28, 2016 16:15
Python script used in Automator workflow to eject trashed images
# Python script to eject disk images passed as args
# Create a new Folder Action in Automator and add a Run Shell Script step
# Set the shell to /usr/bin/python *AND* set "Pass input:" to "as arguments"
# Paste this script and save! Images moved to the trash are now auto-ejected
# Mostly based on http://www.guidingtech.com/26874/eject-delete-dmg-files-automatically/
import os, sys
# Bail if we didn't wipe a DMG
@steverichey
steverichey / trim_screen.sh
Created March 15, 2017 21:47
chop up an Android screenshot real nice
#!/bin/sh
filename="${1%.*}"
convert $1 -gravity North -chop 0x72 ${filename}-trimmed.png
convert ${filename}-trimmed.png -gravity South -chop 0x96 ${filename}-trimmed-both.png
@steverichey
steverichey / zipify.sh
Created July 17, 2017 13:44
this is just a good script with things i might want later
#!/bin/sh
set -eu
ZIP_FILENAME="experience.zip"
JS_FILENAME="template.js"
WTC_FILENAME="tracker.wtc"
DATENAME=`date +"%Y-%m-%d-%H%M%S"`
OUTPUT_JS_DIR="scripts"
OUTPUT_WTC_DIR="augmentation-trackers/4.1"