Skip to content

Instantly share code, notes, and snippets.

View jshbrntt's full-sized avatar
🏠
Working from home

Joshua Barnett jshbrntt

🏠
Working from home
View GitHub Profile
@jshbrntt
jshbrntt / post-commit
Created February 24, 2014 17:20
Hook for writing latest repository short-hash to text file.
#!/bin/sh
rm www/version.txt -i
cat /dev/null > www/version.txt
git rev-parse --short HEAD >> www/version.txt
git add www/version.txt
@jshbrntt
jshbrntt / audio.js
Created May 6, 2014 15:37
Audio for Cordova Mobile Game
/* jshint browser: true, devel: true */
/* global require, module, plugins, Media */
module.exports = {
debug: false,
sounds: {},
clones: {},
root: window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/')) + '/',
manifest: {
failure: 'assets/sounds/failure.mp3',
@jshbrntt
jshbrntt / MatrixOrder.as
Last active August 29, 2015 14:03
Utility functions for swapping a 1D / 2D matrix ordering.
/**
* |0|3|6| => 0 3 6
* | | | | => -----
* |1|4|7| => 1 4 7
* | | | | => -----
* |2|5|8| => 2 5 8
*
* [0,1,2,3,4,5,6,7,8] => [0,3,6,1,4,7,2,5,8]
*
*/
project(racer-sdl)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_executable(${PROJECT_NAME} src/main.cpp)
include(FindPkgConfig)
pkg_search_module(SDL2 sdl2)
@jshbrntt
jshbrntt / example.as
Created December 19, 2014 21:02
Flat2D Utilities Example
KeyManager.held(Key.LEFT)
KeyManager.pressed(Key.A, function():void { addEntity(_player) } );
ContactManager.beginContact("player", "landscape", function():void { _player.alpha = 0.5; } );
ContactManager.endContact("player", "landscape", function():void { _player.alpha = 1; } );
@jshbrntt
jshbrntt / audio2web.sh
Created February 13, 2015 14:13
Script to convert audio to web compatible formats. Note: Because '\|' can't be used in regular expressions on Mac OS X I've used '.*[wavmp3ogg] instead.
#!/bin/bash
find masters -regex '.*[wavmp3ogg]' | while read f; do
file=${f##*/}
filename=${file%.*}
echo "Converting file $f to web/$filename.mp3 web/$filename.ogg"
ff=$(printf '%q' "$f")
RewriteEngine on
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 # Developer IP
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://myhost.co.uk/maintenance.html [R=307,L]
@jshbrntt
jshbrntt / gist:5ba0332ff27ebf91c98a
Last active August 29, 2015 14:22
Point Class in TypeScript, ActionScript, and Java Example
// TypeScript
class Point
{
public x: number;
public y: number;
constructor(x:number = 0.0, y:number = 0.0)
{
this.x = x;
this.y = y;
[root@freenas] ~# gpart list ada2
Geom name: ada2
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 8191999966
first: 34
entries: 128
scheme: GPT
<--------------- RAID Z ----------- --->
3 TB 4 TB 4 TB
+----------+ +----------+ +----------+
| | | | | |
| 3 TB | | 3 TB | | 3 TB |
| | | | | |
+----------+ +----------+ |..........|
| 1 TB | | 1 TB |
+----------+ +----------+
<---------MIRROR--------->