Skip to content

Instantly share code, notes, and snippets.

@error454
error454 / Game1.cs
Created March 1, 2014 02:45
Rain of Arrows
// Rain of Arrows
// Author: Zachary Burke
// 5/7/2010
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
@error454
error454 / quicksort.lua
Created February 11, 2014 02:45
Stonescript Quicksort
-- Adapted from http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Lua
function quicksort (t, start, endi)
start = start or 0
endi = endi or table.getSize ( t ) - 1
if(endi - start < 1) then return t end
local pivot = start
@error454
error454 / proguard-project.txt
Last active January 2, 2016 16:19
Android ShiVa Proguard config
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
@error454
error454 / randomTest.lua
Last active December 25, 2015 12:59
Random number test
function Misc.debugRandomUnitTest ( min, max )
local count = 10000
local tTest = table.newInstance ( )
table.reserve ( tTest, count )
local t_add = table.add
local rand = math.random
local round = math.roundToNearestInteger
for i = 0, count do
t_add(tTest, round ( rand ( min, max) ))
@error454
error454 / themagic.java
Last active December 25, 2015 02:59
Birthday Code
public String doTheMagic(String person, int age){
int randomNumber = 2;
age *= randomNumber;
if(person = null){
person = "Horrible Person";
}
boolean isTheirBirthday = true;
@error454
error454 / Leap Explanation.md
Last active December 20, 2015 22:49
Leap joints etc for Payam.

leapFrame.js defines a function that helps you read and act on a single frame of leap data.
The leap device passes 'frames' of data as it sees objects in the world. A single frame of data has information on how many objects are seen, what direction they're pointing, where they're located in 3D space etc. Take time and look at leapFrame.js and the functions it provides:

  • palm position
  • palm direction
  • palm normal vector
  • finger position
  • finger angle
  • delta finger position

If you need some help figuring out what some of these vectors look like, take a look at the leap documentation, they have nice pictures showing all the axis etc.

@error454
error454 / ouya.rb
Last active December 19, 2015 05:39
Dashing widget for OUYA downloads/purchase scraping.
#!/usr/bin/env ruby
require 'csv'
require 'mechanize'
# OUYA dev stats scraper
#
# This job will download the downloads and purchases csv files from
# the OUYA dev portal and, based on the purchase identifier and
# game title, will send download, sales and conversion ratio to
# the dashboard.
@error454
error454 / TheDemo.as
Last active December 16, 2015 18:09
Kongregate API Integration with Shiva 3D
//-----------------------------------------------------------------------------
// Basic Instructions for getting Kongregate into your export
// In your shiva project, anytime you want to send something to Kongregate stats API you will
// call:
// system.callClientFunction ( "onEngineEvent", sStatisticType, sStatisticName, nValue )
// where sStatisticType is a Kongregate statistic type like "add", "max", "replace"
// sStatisticName is the name of the statistic you've defined on Kongregate
// nValue is the value to send
// Example: system.callClientFunction ( "onEngineEvent", "add", "deaths", 1 )
@error454
error454 / googleAnalyticsCoinAlert.js
Last active January 13, 2018 16:46
Greasemonkey script that plays a sound every time you get a new active user in google analytics realtime view.
// ==UserScript==
// @name Google Analytics Realtime Alerts
// @namespace http://mobilecoder.wordpress.com
// @version 1.0
// @description Plays a sound when you get a new user, you can change the sound by hosting your own file on dropbox or other web location
// @match https://www.google.com/analytics/web/?hl=en#realtime*
// ==/UserScript==
// Your custom sound goes here
mCoinSound = new Audio("https://dl.dropbox.com/u/7079101/coin.mp3");
@error454
error454 / valueCycle.lua
Last active December 15, 2015 10:39
Simple value cycling with wrapping
--------------------------------------------------------------------------------
-- Function......... : cycleValue
-- Author........... : Zachary Burke
-- Description...... : Increases or decreases a variable, handles wrapping the
-- value as well.
--
-- Examples:
-- Say you have a variable nCounter where the max value is 5 and the minimum is 0
--
-- Increment