Skip to content

Instantly share code, notes, and snippets.

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

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / ram.bash
Created March 11, 2015 03:56
Used RAM in Megabytes
top -l 1 | awk '/PhysMem/ {print $2}' | sed s/M//
@tzmartin
tzmartin / queryParamsToJSON.js
Last active August 29, 2015 14:16
Convert query parameters into JSON objects
var str = "myappscheme://foo=bar&hello=world"
var queryParamsToJSON = function(str) {
var result = {}, name;
str = str.split(/:\/\//);
str[1].substring(0, str[1].length).split(/\&|=/).forEach(function(item, idx){
idx%2 ? (result[name] = item) : (name = item);
});
return result;
};
@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
@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 / eventemitter.js
Created April 24, 2015 21:59
EventEmitter Example
var util = require('util'),
EventEmitter = require('events').EventEmitter;
var Server = function() {
var self = this;
EventEmitter.call(this);
this.on('custom_event', function() {
self.logSomething('custom_event');
<?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 / 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 / beme.codes.html
Created September 27, 2015 08:51
Example deep links for Branch.io - Stolen from beme.codes
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" href="http://beme.com/icon.png">
<link rel="apple-itouch-icon" href="http://beme.com/icon.png">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>beme.codes</title>
<script>