Skip to content

Instantly share code, notes, and snippets.

View dawsontoth's full-sized avatar

Dawson Toth dawsontoth

View GitHub Profile
@dawsontoth
dawsontoth / app.js
Last active December 10, 2015 22:38
Demonstrates what using CommonJS can look like for a standard tab group on iOS or Android using Appcelerator Titanium. Note that I recommend placing the "ui-" stuff in a "ui" directory, but Gists don't let me do subdirectories.
var tabGroup = Ti.UI.createTabGroup({
backgroundColor: '#fff'
});
tabGroup.addTab(Ti.UI.createTab({
title: 'Tab 1',
window: require('ui-win1').createWindow(),
icon: 'images/tab-1.png'
}));
@dawsontoth
dawsontoth / refreshChrome.sh
Created December 6, 2012 15:33
osascript to focus chrome, and hit cmd+r to refresh the page.
tell application "System Events"
tell application "Google Chrome" to activate
keystroke "r" using {command down}
end tell
@dawsontoth
dawsontoth / restartTerminal.sh
Created December 6, 2012 15:30
osascript to focus terminal, send ctrl+c, then up, then enter.
tell application "System Events"
tell application "Terminal" to activate
keystroke "c" using {control down}
key code 126
key code 52
end tell
@dawsontoth
dawsontoth / draggable.js
Created July 25, 2012 03:43
Draggable Code Explained, Somewhat
var U = require('utils');
var VBN = require('viewBasedNavigator');
exports.applyTo = function(args) {
args = args || {};
U.def(args, {
id: null,
view: null,
anchor: 'left',
expanded: 320,
@dawsontoth
dawsontoth / app.js
Created April 16, 2012 19:36
Pullable Left Menu
var win = Ti.UI.createWindow({
backgroundColor: '#333'
});
var menuWidth = 200;
var container = Ti.UI.createScrollView({
disableBounce: false,
horizontalBounce: true,
contentWidth: Ti.Platform.displayCaps.platformWidth + menuWidth
@dawsontoth
dawsontoth / xmlToJS.js
Created March 22, 2012 17:25
XML to JS Module
/**
* XMLToJS Module 0.1
*
* To use:
* var XMLToJS = require('xmlToJS');
* var jsObject = XMLToJS.convert(xml);
*
* This will take XMl like the following:
*
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
@dawsontoth
dawsontoth / toolbar.js
Created December 20, 2011 21:09
Segmented Buttons in Appcelerator Titanum
/*
You may download the images for this sample here:
http://dl.dropbox.com/u/16441391/SegmentedButtonImages.zip
*/
var toolbar = Ti.UI.createView({
bottom: 0, height: 45, width: 310,
backgroundImage: 'images/grey.png'
});
toolbar.add(Ti.UI.createLabel({
@dawsontoth
dawsontoth / assets_ti.testjs.js
Created December 19, 2011 23:34
Compiled JS Module in Titanium Mobile
exports.foo = function() {
return 'AHHH!! it works?! wtf...';
};
@dawsontoth
dawsontoth / app.js
Created December 8, 2011 21:06
StoreKit/Example/app.js
/*
Learn the basics of Storekit with this example.
Before we can do anything in our app, we need to set up iTunesConnect! This process can be a little painful, but I will
guide you through it so you don't have to figure it out on your own.
Follow these steps:
1) Log in to your Apple Developer account at https://itunesconnect.apple.com/
2) Click "Manage Your Applications".
@dawsontoth
dawsontoth / index.html
Created December 6, 2011 07:31
Shows How to Use HelpImprove.us
<style type="text/css">
#HI-Container
{
font: 14px Arial, Helvetica, sans-serif;
position: absolute;
top: 200px;
right: 0;
vertical-align: top;
}
#HI-Link