Skip to content

Instantly share code, notes, and snippets.

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

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / genymotion.md
Last active March 28, 2016 22:29
Genymotion Google Patch
@tzmartin
tzmartin / fulcrum.form.model.js
Created July 17, 2014 02:58
Fulcrum app data model
{
"current_page": 1,
"total_pages": 1,
"total_count": 3,
"per_page": 20000,
"forms": [
{
"name": "Building Survey",
"description": "updated",
"bounding_box": [
@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 / gist:7506739
Created November 16, 2013 23:24
Manually install Go v1.1.1 on Debian. Current package manager is 1.0.
sudo apt-get install -y debhelper build-essential autotools-dev
curl -s -o /tmp/go.tar.gz https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
@tzmartin
tzmartin / gist:7312401
Created November 5, 2013 01:31
Run Javascript Textmate command
#!/usr/bin/env bash
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "Javascript Runner" "Open Web Inspector for log"
YOURCODE=`cat`
cat <<HTML
<script>
(function(){try{
@tzmartin
tzmartin / toggle_swap.sh
Created September 5, 2013 07:04
The swap is too damn high. Free it up, but ensure there's enough RAM.
#!/bin/bash
free_data="$(free)"
mem_data="$(echo "$free_data" | grep 'Mem:')"
free_mem="$(echo "$mem_data" | awk '{print $4}')"
buffers="$(echo "$mem_data" | awk '{print $6}')"
cache="$(echo "$mem_data" | awk '{print $7}')"
total_free=$((free_mem + buffers + cache))
used_swap="$(echo "$free_data" | grep 'Swap:' | awk '{print $3}')"
@tzmartin
tzmartin / suggestHeight
Created September 3, 2013 17:49
Native dynamic height calculation for UIViews in Titanium Mobile SDK. Useful for situations where getSize(), getRect() or postLayout event is not sufficient. Typically needed when view dimensions are set to Ti.UI.FILL or Ti.UI.SIZE. Add this method to TiUiLabelProxy.m, TiUITableViewProxy.m Reference: http://developer.appcelerator.com/question/14…
-(id)suggestHeight:(id)arg
{
CGFloat height = 0;
// resolve arg
if (arg != nil && [arg isKindOfClass:[NSArray class]])
{
NSArray *args = (NSArray *)arg;
if (args.count > 0)
arg = [args objectAtIndex:0];
- Add a Pre-Compile script in Xcode projects for all Titanium builds. This snippet will pre-compile Alloy projects in Xcode for faster debug workflows.
proj = injectCompileShellScript(
proj,
'Pre-Compile',
"alloy compile "+this.projectDir+"\n\n"+'if [ \\"x$TITANIUM_CLI_XCODEBUILD\\" == \\"x\\" ]; then NO_COLORS=\\"--no-colors\\"; else NO_COLORS=\\"\\"; fi\\n' +
(process.execPath || 'node') + ' \\"' + this.cli.argv.$0.replace(/^(.+\/)*node /, '') + '\\" build --platform ' +
this.platformName + ' --sdk ' + this.titaniumSdkVersion + ' --no-prompt --no-banner $NO_COLORS --xcode\\nexit $?'
);
@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 / geolocate.js
Created July 18, 2012 22:51
Roll your own reverse/forward geolocator in Titanium
/* Roll your own reverse/forward geolocator
*
* YQL
*/
Titanium.Yahoo.yql('select * from yahoo.maps.findLocation where q="'+latitude+','+longitude+'" and gflags="R"',function(e) {
var woeid = e.data.ResultSet.Results.woeid;
Titanium.API.info(woeid);
});
/*