Skip to content

Instantly share code, notes, and snippets.

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

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
<?php
answer();
say ("Welcome.");
$question_cnt = 1;
function ask_question($q)
{
switch ($q) {
@tzmartin
tzmartin / DNfolio.com - 1-13-11
Created January 13, 2011 17:42
Aftermarket Domain List from DNfolio.com - 1/13
Hello,
Here are today's domains for your review.
First to reply will get them - these are domain only sales with no sites or content - assume minimal traffic
Payment via PayPal within 24 hours - Domains are at GoDaddy
Jeff K.
dnfolio@gmail.com
@tzmartin
tzmartin / gist:1018258
Created June 10, 2011 05:04 — forked from omorandi/gist:1013226
Two methods for sending SMS messages with Titanium Mobile on Android throught native intents
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200});
bt1.addEventListener('click', function(e)
@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

@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 / 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 / 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 / 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 / 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 / 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;