Skip to content

Instantly share code, notes, and snippets.

View FokkeZB's full-sized avatar
*️⃣
Zappin'

Fokke Zandbergen FokkeZB

*️⃣
Zappin'
View GitHub Profile
@FokkeZB
FokkeZB / String.printf.js
Created December 19, 2014 11:46
printf for JS
// examples;
// "{f} {b}".printf({f: "foo", b: "bar"});
// "%s %s".printf(["foo", "bar"]);
// "%s %s".printf("foo", "bar");
String.prototype.printf = function (obj) {
var useArguments = false;
var _arguments = arguments;
var i = -1;
if (typeof _arguments[0] == "string") {
useArguments = true;
@FokkeZB
FokkeZB / .jsbeautifyrc
Created December 12, 2014 10:57
XML-TSS-JS Prettify
{
"html": {
"indent_char": " ",
"indent_size": 2
},
"css": {
"indent_char": " ",
"indent_size": 2
},
"js": {
@FokkeZB
FokkeZB / Analytics.md
Last active April 3, 2018 08:20
Options for analytics & crash reports for Titanium apps

Analytics & Crash options for Titanium

Service Analytics Performance Errors Titanium SDK Costs
New Relic Limited (users) HTTP HTTP Incomplete (no crashes) Free, $29/mo
Google Analytics Extensive Manual Native (no traces) Abandoned, Out-dated Free
Appcelerator Platform Extensive HTTP Native + JS Up-to-date Not public
Count.ly Extensive N/A N/A gitTio OSS, $125/mo
Flurry Extensive N/A Native gitTio, Marketplace Free
Crit
@FokkeZB
FokkeZB / Gruntfile.js
Created October 18, 2014 18:24
Example Gruntfile.js for The Ultimate Titanium CLI Toolchain at Connect.js
module.exports = function(grunt) {
grunt.initConfig({
settings: {
releaseNotes: grunt.option('notes') || 'CI build',
appName: 'Flashlight',
ppUuid: '0253600x-ac6d-35b6-b66d-dd25c4fd956f',
installrAppToken: '6xC0I8SdJA76kW3pqq7GFZLIyq6fBP4Z'
},
@FokkeZB
FokkeZB / .bash_profile
Created October 3, 2014 13:47
Alias for making screenshots from connected Android device/emulator
alias screenshot='adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "/Users/fokkezb/Downloads/android_$(date +%Y%m%d-%H%M%S).png"'
# NOTE: Replace 'fokkezb' with your user. You cannot use ~ when using $() unfortunately
@FokkeZB
FokkeZB / index.js
Last active November 5, 2015 17:15
Checking for Titanium API objects
var jsObject = {
foo: 'bar'
};
var tiObject = Ti.UI.create2DMatrix();
function isJsObject(obj) {
return typeof obj.__proto__ !== 'undefined';
}
@FokkeZB
FokkeZB / index.php
Created September 19, 2014 07:04
Test URL schemes
<?
$scheme = isset($_GET['scheme']) ? $_GET['scheme'] : 'twitter';
$path = isset($_GET['path']) ? $_GET['path'] : '/';
$id = isset($_GET['id']) ? $_GET['id'] : 333903271;
$package = isset($_GET['scheme']) ? $_GET['scheme'] : 'com.twitter.android';
$auto = isset($_GET['auto']);
// Detection
$HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']);
@FokkeZB
FokkeZB / app.js
Last active August 29, 2015 14:06
addEventListenerOnce
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
win.addEventListener('click', function foo(e) { // note the named function expression needed for the second way
// oringal idea by @fukhaos
// http://www.tidev.io/2014/09/10/the-case-against-ti-app-fireevent-2/#comment-13013
e.source.removeEventListener(e.type, arguments.callee);
{
"browser": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
@FokkeZB
FokkeZB / console.log
Created February 8, 2014 13:45
gitTio & widget dependencies
$ gittio install nl.fokkezb.drawer@master -p ios,android
[INFO] nl.fokkezb.drawer searching...
[INFO] nl.fokkezb.drawer@master:ios,android downloading...
[INFO] nl.fokkezb.drawer@master:ios,android installing...
[INFO] dk.napp.drawer searching...
[INFO] nl.fokkezb.drawer@master:ios,android installed
[INFO] dk.napp.drawer@1.1.4:ios downloading...
[INFO] dk.napp.drawer@1.1.1:android downloading...
[INFO] dk.napp.drawer@1.1.4:ios installing...
[INFO] dk.napp.drawer@1.1.1:android installing...