Skip to content

Instantly share code, notes, and snippets.

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

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@tzmartin
tzmartin / array.xml
Last active June 26, 2017 06:06
The Android equivalent to Settings.bundle is called Preferences. The preferences configuration files must be created in the project folders, platform/android/res/xml/preferences.xml and platform/android/res/values/array/array.xml.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="listNames">
<item>5 Minutes</item>
<item>10 Minutes</item>
<item>15 Minutes</item>
<item>30 Minutes</item>
<item>60 Minutes</item>
</string-array>
<string-array name="listValues">
@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>
@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');
@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
@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 / ram.bash
Created March 11, 2015 03:56
Used RAM in Megabytes
top -l 1 | awk '/PhysMem/ {print $2}' | sed s/M//
// 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 : {};