This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper Functions for Handlebars Templating engine | |
*/ | |
var fs = require('fs'), | |
path = require('path'), | |
Arrow = require('arrow'); | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple and quick port of | |
// | |
// find -E . -type f -not -regex "^\./\.git/.*" | awk 'BEGIN {FS="."} {tally[$NF]+=1} END {for (key in tally) {printf "%d: %s\n", tally[key], key}}' | sort -n -k 1,1 | tail -r | |
// | |
var wrench = require('wrench'), | |
fs = require('fs'), | |
path = require('path'), | |
_ = require('lodash'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = Ti.UI.createWindow(); | |
var v = Ti.UI.createView({backgroundColor:'white'}); | |
w.add(v); | |
var t = Ti.UI.createLabel({text:'It works!'}); | |
v.add(t); | |
w.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = Ti.UI.createWindow(); | |
w.open(); | |
w.backgroundColor = 'red'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ti sdk | grep "\[selected\]" | awk '{print $1}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto _Folder = Windows::Storage::ApplicationData::Current->LocalFolder; | |
auto _Option = Windows::Storage::CreationCollisionOption::ReplaceExisting; | |
// create file async | |
_Folder->CreateFileAsync("MyFileName", _Option); | |
// create file sync by wrapping in task - then pattern | |
IAsyncOperation<StorageFile^>^ fileOp = _Folder->CreateFileAsync("MyFileName2", _Option); | |
auto deviceEnumTask = create_task(fileOp); | |
deviceEnumTask.then([](StorageFile^ myFile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getKeys(obj, keys) { | |
keys = keys || {}; | |
Object.keys(obj).forEach(function(k){ | |
if (!k in keys) { | |
var o = obj[k]; | |
keys[k] = 1; | |
if (typeof o === 'Object') { | |
getKeys(o,keys); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sprintf = require('util').format, | |
timer; | |
function play(arr, interval) { | |
var len = arr.length | |
, interval = interval || 100 | |
, i = 0; | |
timer = setInterval(function(){ | |
var str = arr[i++ % len]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is an example of use. | |
// Here we use the new Bearer Token thats make it possible to get tweets without user login | |
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth | |
// Full Codebird API is here: https://github.com/mynetx/codebird-js | |
var Codebird = require("codebird"); | |
var cb = new Codebird(); | |
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY'); | |
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null); |