Skip to content

Instantly share code, notes, and snippets.

@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 / AndroidManifest-Common
Created January 28, 2015 21:56
Just some AndroidManifest values. I forget these a lot I guess.
<!-- Camera -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<!-- GPS -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
@steverichey
steverichey / Iconizer.sh
Last active February 23, 2022 17:40
Create iOS application icons from one PDF file. Requires ImageMagick.
#!/bin/sh
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
#
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file.
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Images.xcassets
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject
#
# Requires ImageMagick: http://www.imagemagick.org/
@steverichey
steverichey / pw.sh
Last active May 15, 2018 09:28
Generates a random string of a specified length.
#!/bin/sh
set -e
if [ "$#" -lt 0 ]; then
echo "Usage: pw 16 [lim]"
exit 1
fi
if [ "$#" -gt 2 ]; then
Here's a list of the strings in the game (SPOILERS kinda):
A game by: Et spil af
Powered by: Kører på
Press left or right to start: Tryk venstre eller højre for at starte
Release left and right: Slip venstre og højre
to start: for at starte
to erase: for at slette
Touch left or right side to start: Tryk venstre eller højre side for at starte
Release both sides: Slip begge sider
@steverichey
steverichey / Localization Strings
Created August 7, 2014 19:23
Localization strings for Don't Move
Here's a list of the strings in the game (SPOILERS kinda):
A game by
Powered by
Press left or right to start
Release left and right
to start
to erase
Touch left or right side to start
Release both sides
@steverichey
steverichey / Don't Move Preloader
Created June 12, 2014 12:51
The preloader for Don't Move, uses HaxeFlixel 4.0.0-dev
package states;
import flash.Lib;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flixel.system.FlxBasePreloader;
class Preloader extends FlxBasePreloader
{
private var _progressBar:Bitmap;
@steverichey
steverichey / RenderTilemapToSprite
Last active August 29, 2015 14:01
Drawing a FlxTilemap to a FlxSprite
import flixel.FlxCamera;
import flixel.FlxSprite;
import flixel.tile.FlxTilemap;
class Util
{
static public function renderTileMapToSprite(Tiles:FlxTilemap, Sprite:FlxSprite):Void
{
var tempCam:FlxCamera = new FlxCamera(0, 0, Std.int(Tiles.width), Std.int(Tiles.height));
Sprite.makeGraphic(Std.int(Tiles.width), Std.int(Tiles.height), 0);
@steverichey
steverichey / Splat.hx
Last active August 29, 2015 13:57
Dissolving pixels per frame.
package;
import flash.display.BitmapData;
import flash.geom.Point;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.util.FlxColor;
import flixel.util.FlxColorUtil;
import flixel.util.FlxRandom;
import openfl.Assets;
@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
{