Skip to content

Instantly share code, notes, and snippets.

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

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / json.md
Last active July 26, 2016 18:37 — forked from geuis/json.js
JSON CommonJS wrapper

Simple wrapper around JSON global that adds graceful error handling via try/catch. 😋

module.exports = (function(){
 
    var parse = JSON.parse;
 
    return {
 
        stringify: JSON.stringify,
@tzmartin
tzmartin / app.tss
Last active August 29, 2015 14:19 — forked from tonylukasavage/app.tss
'Label[platform=android]': {
color: '#000' // all platforms except Android default to black
}
'Window': {
backgroundColor: '#fff' // white background instead of default transparent
}
'Window[platform=android]': {
modal: false // make android windows all heavyweight
@tzmartin
tzmartin / mov2gif
Last active August 29, 2015 14:17 — forked from artursapek/mov2gif
#!/bin/bash
# mov2giv in out width
# mov2gif video_file_in.mov gif_file_out.gif 300
tmp_dir=/tmp/frames_$(date +%s)
mkdir $tmp_dir
if [ -z "$3" ]
then
size=600
// backbone collections lack a search functionality. This adds it to all collections.
// fuse.js is the library that powers the fuzzy search and requires being downloaded and included into your app
// http://kiro.me/projects/fuse.html
_.extend(Backbone.Collection.prototype, {
searchableFields: null,
buildSearchIndex: function(options) {
options = (typeof options !== 'undefined') ? options : {};

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@tzmartin
tzmartin / anim.js
Last active August 29, 2015 14:09 — forked from guiled/anim.js
// next two from http://stackoverflow.com/a/5624139/292947
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
function rgbToHex(r, g, b) {
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
@tzmartin
tzmartin / index.xml
Last active August 29, 2015 14:08 — forked from jasonkneen/index.xml
<!-- note the ONLY change to this is the additional module="tabIndicator"
attribute + properties to override indicator defaults //-->
<Alloy>
<TabGroup module="tabIndicator" tabsBackgroundColor="#000" tabIndicatorHeight="1" tabIndicatorColor="white" tabIndicatorWidth="75%">
<Tab title="Tab 1" icon="/images/icons/519-tools-1.png" activeIcon="/images/icons/519-tools-1_active.png" color="#555" activeColor="#fff">
<Window title="Tab 1" barColor="black" navTextColor = "#fff">
<Label onClick="openWin1">Tab 1</Label>
</Window>
</Tab>
<Tab title="Tab 2" icon="/images/icons/516-archive-box.png" activeIcon="/images/icons/516-archive-box_active.png" color="#555" activeColor="#fff">
@tzmartin
tzmartin / AECurl
Created July 2, 2014 07:21 — forked from matthijn/AECurl
<?php
/* A quick emulator for common curl function so code based on CURL works on AppEngine */
if(!function_exists('curl_init'))
{
// The curl option constants, when there is no curl they are not defined so we define them here
// Some options don't do anything, they just prefent crashes when they are here (see the setOpt method for the support of different options)
define('CURLOPT_RETURNTRANSFER', 'CURLOPT_RETURNTRANSFER');
define('CURLOPT_SSL_VERIFYPEER', 'CURLOPT_SSL_VERIFYPEER');
@tzmartin
tzmartin / ScrollingMatrix.ino
Created July 29, 2012 16:32
Scrolling LED Matrix Display for Arduino
const int clockPin = 13;
const int dataPin = 11;
const int latchPin = 10;
byte arrow[8]={0x18,0x3C,0x66,0xDB,0x18,0x18,0x18,0x18};
byte displayBuffer[8]= {0};
int fontDefinitions[475] = {
0x00,0x00,0x00,0x00,0x00,/*space*/ // is 32 in ASCII
0x00,0xF6,0xF6,0x00,0x00,/*!*/
@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;