Skip to content

Instantly share code, notes, and snippets.

View tzmartin's full-sized avatar
🏴‍☠️
ahoy!

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / titanium.windows7.debug.txt
Created July 17, 2012 17:40
Titanium Windows 7 installation helper notes..
* These are personal notes taken from various training events for debugging Windows 7 installation...
----------------
1. Uninstall McAfee. Stop ALL McAfee services (services.msc)
2. Verify Internet access.
Add proxy for downloading (optional)
proxy.cognizant.com 6050
3. Install Java JDK v1.6.x (1.7 is not supported)
4. Move Android SDK to
@tzmartin
tzmartin / video.thumbnail.js
Created July 10, 2012 17:46
Create Thumbnail Image From Video File, Titanium Mobile
/**
Create Thumbnail of Video File
This snippet captures a thumbnail JPG image, based on a frame @ 2 second time-lapse.
Titanium Mobile
*/
var movie = Titanium.Media.createVideoPlayer({
contentURL:FILENAME,
@tzmartin
tzmartin / TiUIScrollableView.m
Created July 8, 2012 07:33
TiUIScrollableView Mods
/**
TiUIScrollableView.m
Currently, ScrollableViews do not listen for x,y changes during scroll events (touchmove). This mod fixes that. It adds additional x,y coords to the scroll event, similar to scrollViews.
Outputs:
currentPage = 0;
source = "[object TiUIScrollableView]";
type = scroll;
@tzmartin
tzmartin / mdb.js
Created June 19, 2012 20:29 — forked from kirbysayshi/mdb.js
example showing how to wrap node-mongodb-native driver in promises. uses jquery deferreds from https://github.com/kirbysayshi/jquery-jqd
var mongo = require('mongodb')
,jqd = require('../jquery-jqd').jqd
,host = process.env['MONGO_NODE_DRIVER_HOST'] != null
? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'
,port = process.env['MONGO_NODE_DRIVER_PORT'] != null
? process.env['MONGO_NODE_DRIVER_PORT'] : mongo.Connection.DEFAULT_PORT
,db = null
,gConnection = null;
@tzmartin
tzmartin / gist:2716580
Created May 17, 2012 05:10 — forked from benbahrenburg/gist:1515352
Titanium : How to find the Private Directory
function privateDocumentsDirectory(){
Ti.API.info('We need to open a file object to get our directory info');
var testFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory);
Ti.API.info('Now we remove the Documents folder reference');
var privateDir = testFile.nativePath.replace('Documents/','');
Ti.API.info('This is our base App Directory =' + privateDir);
Ti.API.info('Now we add the Private Documents Directory');
privateDir+='Library/Private%20Documents/';
Ti.API.info('Our new path is ' + privateDir);
@tzmartin
tzmartin / Titanium-Android.txt
Created March 24, 2012 04:39
Titanium Android Modules
Titanium Android Modules
--------------------------------------
- https://github.com/dbankier/TiKeyguard-Android
Appcelerator/Titanium module to unlock and power on an Android device.
- https://github.com/dbankier/TiSIPClient-Android
SIP/VoIP for Appcelerator's Titanium (Android)
- https://github.com/3ign0n/TiOpenStreetMap
@tzmartin
tzmartin / LICENSE.txt
Created February 22, 2012 03:41 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tzmartin
tzmartin / gist:1372475
Created November 17, 2011 05:53
UIModule Error Hack
/*
* This is a hack solves the "Invalid method passed to UIModule" error
* It works by forcing Titanium to load SDK components into memory.
*
* Drop this file anywhere in your project and DON'T Ti.include() it.
* Be sure this file extension is .js.
* Clean and recompile your project.
*
* Enjoy!
* @tzmartin
@tzmartin
tzmartin / GPointGenerator.html
Created August 12, 2011 07:05 — forked from rgabbard/GPointGenerator.html
Point generator for Google Map routes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Utility to generate points along a route using the Google Maps API
Directions service.
2011-03-31 Rob Gabbard, cintimedia LLC, www.cintimedia.com
Based on the Google Maps API Optimized Directions demo at:
@tzmartin
tzmartin / on-javascript-callbacks.md
Created June 15, 2011 11:34 — forked from lamberta/on-javascript-callbacks.md
On JavaScript callbacks, program flow control and the functional style.

One of the first things a newcomer to JavaScript will notice when confronted with the modern style is the prevalence of function objects passed as parameters to other functions, or callbacks. What is not immediately apparent is why this higher-order function style needed. In short, functional arguments give us a way to delay the execution of a block of code. This kind of program flow control means we can approximate some powerful abstraction techniques usually reserved for macros in other languages.

Here's a typical callback example you'll find on the client-side, attaching a click event handler to a DOM element:

var callback = function (evt) { console.log("Element clicked!"); };
element.addEventListener('click', callback);

Here we've created a variable to hold our callback function. Next we have our DOM element listen for click events and, when it has one, execute our function. The callback function has been taken out of the normal program flow to be run at another time, or in this case, when the