Skip to content

Instantly share code, notes, and snippets.

View euforic's full-sized avatar

Christian Sullivan euforic

View GitHub Profile
@euforic
euforic / MegaStream.js
Created May 4, 2013 04:52
Mega Stream
/**
* Expose `Stream`.
*/
if ('undefined' !== typeof module) {
module.exports = Stream;
}
/**
@euforic
euforic / app.js
Last active March 15, 2017 14:27
Node.js Libraries for all Titanium platforms | Available Modules [ net, stream (node 9.x version), assert, buffer, util, events ] Still a work in progress
/**
* Available node core libraries
*/
var node = require('node')
, assert = node.assert
, buffer = node.buffer
, events = node.events
, net = node.net
, stream = node.stream
@euforic
euforic / dataBind.js
Created March 6, 2013 00:31
two way databinding example implementation
/**
* two way data binding
*/
// create root scope
window.$rootScope = {};
@euforic
euforic / require.js
Last active December 14, 2015 09:58
Node Style require for browser and Titanium
/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/
function require(path, parent, orig) {
var resolved = require.resolve(path);
@euforic
euforic / cli_log.js
Created January 22, 2013 22:08
cli logging objects
var x = {
"test": 1,
"test2": 2,
"testArray": [1,2,3,4]
};
console.log('TEST',x);
/**
* OUTPUT
@euforic
euforic / battery.sh
Created December 10, 2012 18:32
Battery Health and Cycles
osascript -e 'set a to do shell script "ioreg -w0 -l | grep Capacity"' -e "set h to word 5 of a" -e "set z to word 33 of a" -e "set b to word 38 of a" -e "set c to 1000 * b / z" -e "set d to round c" -e "set f to d / 10" -e "set q to 1000 * h / b" -e "set w to round q" -e "set j to w / 10" -e '"Battery Health: " & j &"%"' | iconv -f utf-8 -t ucs-2-internal;
@euforic
euforic / git-ticket
Created December 4, 2012 01:26
Jira Ticket Git Shortcut Command
if test "$1" = "finish"; then
test -z $2 && echo "ticket <name> number." 1>&2 && exit 1
branch=timob-$2
git checkout master
git branch -D $branch && git push origin :$branch
else
test -z $1 && echo "ticket <name> required." && exit 1
branch=timob-$1
git checkout -b $branch &> /dev/null
git checkout $branch &> /dev/null
/File generated Using psd2ti
var self = Ti.UI.createWindow();
self.open();
var bg = Ti.UI.createImageView({
top: 0, left: 0,
height: 480, width:320,
backgroundImage: 'images/bg.png'
@euforic
euforic / view.js
Created October 22, 2012 06:10
MVC Breakout - VIEW
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// Module Exports
var self = module.export = {};
// create tab group
self.tabGroup = Titanium.UI.createTabGroup();
@euforic
euforic / apibuilder.js
Created September 18, 2012 04:02
API Builder
/*!
* apibuilder
* Copyright (c) 2012 Christian Sullivan <cs@euforic.co>
* MIT Licensed
*/
var request = require('superagent');
/**
* Module Exports