Skip to content

Instantly share code, notes, and snippets.

@oodavid
oodavid / Titanium Build Script for Sublime-Text-2
Last active December 9, 2015 23:29
Titanium Build Script for Sublime-Text-2
Once you have Titanium running, including Command-Line-Interface, this build script can be used with sublime-text to compile and pass to the attached android device.
Note that on windows you will probably need an additional "shell" parameter...
## Useful References
* https://wiki.appcelerator.org/display/guides/Titanium+Command+Line+Interface
* http://unbounded.io/post/28394170197/titanium-mobile-develpoment-with-sublime-text-2-and
* http://www.slideshare.net/cb1kenobi/exploring-the-titanium-cli-codestrong-2012
@oodavid
oodavid / dump.js
Last active June 6, 2025 00:31
This function acts like PHPs native print_r or var_dump and will dump out ANY variable to the console. Originally written for Appcelerator Titanium (using Ti.API.info instead of console.log) but tweaked to work with the console. There are plenty of alternatives to this, however I wanted to write my own so I could control the format / have a go :-)
/**
* DUMP
*
* Dumps a variable in a readable form to the console, this is a recursive function
* so be careful of nested references that may cause it to overflow... (untested for that)
*
* @v ANYTHING [Any variable]
* @name STRING [The name of the variable, optional, used internally when looping objects and arrays]
* @spacing STRING [The prefix spacing, used internally when looping objects and arrays]
*/
@oodavid
oodavid / Bubbler.php
Created March 19, 2013 12:11
OOP - Method and Property bubbling in PHP
<?php
/**
* BUBBLER CLASS
*
* The Magic Methods __get, __set and __call are called by PHP when the object cannot
* find or access methods or properties within the object, the Bubbler class intercepts
* these and simply routes them to their "parent" object.
*
* +--------------------------------------+
* | Object A /\ Plain Object |
@oodavid
oodavid / tumblr2jekyll.php
Last active December 15, 2015 23:59
PHP script to convert tumblr blog articles to jekyll posts, modify the settings then simply run this in your terminal: php tumblr2jekyll.php More on the blog - http://oodavid.com/2013/04/09/convert-from-tumblr-to-jekyll-using-php.html
<?php
//
// Settings
//
// Blog URL
$blog = 'oodavid.tumblr.com';
// Tumblr API key - register for one here: http://www.tumblr.com/oauth/apps
$api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// Local folder to write to - PHP must be able to write here
@oodavid
oodavid / index.html
Last active December 18, 2015 14:58
Convert Google Spreadsheeets to JSON
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Spreadsheet to JSON...</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="http://jquery-csv.googlecode.com/files/jquery.csv-0.71.min.js"></script>
<script>
// Which file to load?
var csv = 'https://docs.google.com/spreadsheet/pub?key=0AmqTMmxb4MxEdE9vUHVPdWs1WjlJR1JlbFJubi14VkE&single=true&gid=0&output=csv';
@oodavid
oodavid / README.md
Last active December 21, 2015 10:38
Android - Compile, Install, Run and Debug

Will require tweaking for your environment as I've hardcoded some binary paths.

Requires all the usual gubbins to compile android:

  • Apache ANT
  • Android
  • Android ADB
  • Android Monitor

If you want to use this with sublime-text, then you'll need a simple build script:

@oodavid
oodavid / animate.js
Created October 28, 2013 11:08
GameClosure Patch > Additional Transition / Easing Functions - I couldn't find the proper repo to commit this, so just dumping into a gist for the time being.
// sdk/timestep/ui/backend/animate.js
/**
* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK is distributed in the hope that it will be useful,
@oodavid
oodavid / nexgen.pull.sh
Last active December 27, 2015 07:39
Install NexGen Server
#!/bin/bash
#
# Install NexGen Server
# https://gist.github.com/oodavid/7290587
#
# To download
# cd /home/ubuntu/
# wget -O nexgen.pull.sh https://gist.github.com/oodavid/7290587/raw/nexgen.pull.sh
#
# To run at boot
@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 / version.sh
Created March 3, 2014 16:30
Git > Get changes in VERSION for tagging purposes
# Search common.php for changes in the VERSION
# Note - won't follow line changes, it always looks at line 11...
git log --all --format=format:%H -G'\$VERSION' common.php | xargs -L 1 git blame common.php -L 11,11 > ~/versions.txt