Skip to content

Instantly share code, notes, and snippets.

@oodavid
oodavid / Application.js
Last active August 29, 2015 13:56
Demonstration of the various easing types in GameClosure
import device;
import animate;
import ui.View as View;
import ui.TextView as TextView;
// A list of all easing types
var easings = [
'linear',
'easeInQuad',
'easeIn',
@oodavid
oodavid / .gitconfig
Created June 16, 2014 08:03
Alias for a redacted graph log. Add to ~/.gitconfig
[alias]
tree = log --graph --color --all --pretty=format:"%C(yellow)%h%C(green)%d%C(reset)%n%x20%C(blue)%cn%C(reset)%x20%cd%n%x20%s%n"
@oodavid
oodavid / Particles.js
Created December 16, 2014 08:59
GameClosure > Particles
/** MOLECULE MATCH - Particles
*
* Utility View for GameClosure DevKit to add an
* explosion of Particles anywhere on the screen.
*
* Modified for github
*
* @author David "oodavid" King
* @copyright Copyright (c) 2014 +
*/
@oodavid
oodavid / gist:65d0f5ca76b8cd8bd9e1
Last active August 29, 2015 14:24
devkit v3 upgrade - android build issues - IRC fix
oodavid morning jdwilm
oodavid jdwilm: do you have a moment to look at issues building for android?
jdwilm oodavid: can you check that you have the core folder in native-android?
jdwilm seems like there might be a missing sym link or submodule
oodavid shall do :)
jdwilm I think there is a missing symlink in native-android/TeaLeaf/jni named 'core' which should point to native-android/native-core submodule
jdwilm Incidentally, we could probably just move the submodule and obviate the need for such a link
oodavid jdwilm: yeah, that looks like the case
oodavid just trying to figure out where npm has installed native-android/native-core
jdwilm It should be on $GAME/modules/devkit-core/modules/native-android
@oodavid
oodavid / Application.js
Last active August 29, 2015 14:25
GC > New Groups Paradigm Bug
import ui.TextView as TextView;
import ui.View as View;
import device;
import animate;
var gx = Math.ceil(device.width/20);
exports = Class(GC.Application, function () {
this.initUI = function () {
// A note
new TextView({
superview: this.view,
@oodavid
oodavid / README.md
Created March 27, 2012 08:29
CentOS AMP Server Setup

CentOS AMP Server Setup

I think I'd like to write (for fairly perverse reasons) a script that will setup something like this on a CentOS server:

  • Got CentOS?
  • Got root?
    • Update CentOS
    • Set hostname, timezone etc
    • Install Apache, MySQL, PHP, ImageMagick, S3cmd, Git etc.
  • Setup Git with Apache user and pull from github / bitbucket to /var/www/html/
@oodavid
oodavid / recursive_killing.js
Created March 30, 2012 08:10
Recursive Killing
// Build a deep object of some sort
var ob = {
type: 'windar',
title: 'Hello World',
children: [
{
type: 'BUTTUN',
title: 'click me',
},
{
@oodavid
oodavid / README.md
Created April 12, 2012 20:01
MySQL - Group by grid-square

MySQL - Group by grid-square

Inspired by the police.uk crime maps, where they cleverly cluster data together depending on how far zoomed in you are, this MySQL snippet goes a long way to explaining the logic behind such an operation.

A perfect grid

This snippet groups sites to a perfect grid while the police.uk algorithm has some sort of trickery that moves their points about somewhat, looking at their blogs and documentation I would conclude that they have a predefined set of points, each with a catchment area of postcodes. It looks like a whole lot of scraping and manual labour went into their database and quite frankly I don't have the time nor inclination do attempt such a task.

Example

@oodavid
oodavid / primes.js
Created May 18, 2012 10:25
Prime Numbers Algorythm
/**
* You can check if a number is a prime by looping the known primes to see if it divides.
*/
// Seed the primes array
var primes = [2,3];
// Start counting up...
myCounter : for(n=5; n<10000; n+=2){
// Loop the known primes
for(p=0, l=primes.length; p<l; p++){
@oodavid
oodavid / README.md
Created June 20, 2012 13:32
MySQL to Structured Data (EXPERIMENT)

Found this little experiment in the depths of one of my projects; I've removed it and dumped it here in case I want it in the future