Skip to content

Instantly share code, notes, and snippets.

View stephenfeather's full-sized avatar

Stephen Feather stephenfeather

View GitHub Profile
@stephenfeather
stephenfeather / sequencer.js
Created June 10, 2014 03:26
Ti.Media.Sound sequencer
/*jslint vars: true, plusplus: true, sloppy: true, nomen: true, maxerr: 1000 */
function Sequencer(){
var self = {};
var song, songTitle, currentNote, totalNotes, noteBatch, notes, timeouts = [];
if(Ti.App.Properties.hasProperty('noteBatch')){
noteBatch = Ti.App.Properties.getInt('noteBatch');
}else{
Code to detect a Gimbal beacon (without reading encrypted identifiers):
BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
BeaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:0-3=ad7700c6"));
beaconManager.bind(this);
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
# things you must configure
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder
TWITTER_USER = "your_twitter_username"
@stephenfeather
stephenfeather / app.js
Created February 20, 2012 16:48 — forked from dawsontoth/app.js
Rate my app in Appcelerator Titanium Mobile
/**
* The following snippet will ask the user to rate your app the second time they launch it.
* It lets the user rate it now, "Remind Me Later" or never rate the app.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.addEventListener('open', checkReminderToRate);
win.add(Ti.UI.createLabel({ text: 'This is a simple app that will remind you to rate it.' }));
win.open();
function checkReminderToRate() {
@stephenfeather
stephenfeather / Gruntfile.js
Last active October 2, 2015 18:18
Appcelerator Gruntjs
module.exports = function(grunt) {
require('time-grunt')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
CHANGELOG: '',
// add tiapp.xml changes to the repo
gitadd: {
versionBump: {
options: {
@stephenfeather
stephenfeather / tracer.js
Created June 1, 2012 23:41 — forked from jeffbonnes/tracer.js
A tracer object to Titanium Mobile to show elapsed time and memory usage
/**
* Courtesy of Jeff Bonnes
* http://www.titaniumdevelopment.com.au/blog/2011/09/12/debugging-ipad-performance-and-memory-usage/
*/
/**
* Modified to a commonJS format by Stephen Feather
* Usage:
* var Tracer = require('/lib/tracer');
ulimit -n 65536 65536
export ANDROID_SDK=/sdks/android-sdk-macosx
export ANDROID_HOME=/sdks/android-sdk-macosx
export ANDROID_PLATFORM="$ANDROID_SDK/platforms/android-23"
export GOOGLE_APIS="$ANDROID_SDK/add-ons/addon-google_apis-google-23"
export ANDROID_NDK=/sdks/android-ndk-r9b
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:$MONGO_PATH/bin:/sdks/android-sdk-macosx/tools:/sdks/android-sdk-macosx/platform-tools:$JAVA_HOME/bin:/Applications/Genymotion\ Shell.app/Contents/MacOS/:/Applications/Genymotion.app/Contents/MacOS/
@stephenfeather
stephenfeather / ImageProcessor.js
Created January 4, 2013 12:19
Module that uses the ti.imagefactory module to resize images.
/*jslint vars: true, sloppy: true, nomen: true, maxerr: 1000 */
function ImageProcessor(imagePath){
//if (Ti.App.Properties.getInt('CompressImages') === 1){
var ImageFactory = require('ti.imagefactory');
Ti.API.info('Compressing and Resizing Image');
var tempFile = Ti.Filesystem.getFile(imagePath);
var imageBlob = tempFile.read();
// ==UserScript==
// @name Ingress Player Locations
// @description Shows player locations on the Ingress Intel Map
// @version 1.2
// @match http://www.ingress.com/intel
// @run-at document-start
// ==/UserScript==
function override() {
@stephenfeather
stephenfeather / validation.js
Created May 12, 2013 15:21
Simple validation and typing functions
exports.trim = function(s) {
//alert('hi');
var l = 0;
var r = s.length - 1;
while (l < s.length && s[l] == ' ') {
l++;
}
while (r > l && s[r] == ' ') {
r -= 1;
}