Skip to content

Instantly share code, notes, and snippets.

View stephenfeather's full-sized avatar

Stephen Feather stephenfeather

View GitHub Profile
@stephenfeather
stephenfeather / app.js
Last active December 29, 2015 11:59
Sample code for Richard Olenick in answer to http://developer.appcelerator.com/question/159878/trying-to-switch-windows-with-use-of-a-button-click#comment-195523 assumes all these files are in Resources/
var Login = require('loginScreen');
var loginPage = new Login();
loginPage.open();
/*jslint vars: true, sloppy: true, nomen: true, maxerr: 1000 */
function LatLon(lat, lon, rad) {
if (typeof(rad) == 'undefined') rad = 6371; // earth's mean radius in km
// only accept numbers or valid numeric strings
this._lat = typeof(lat)=='number' ? lat : typeof(lat)=='string' && lat.trim()!='' ? +lat : NaN;
this._lon = typeof(lon)=='number' ? lon : typeof(lon)=='string' && lon.trim()!='' ? +lon : NaN;
this._radius = typeof(rad)=='number' ? rad : typeof(rad)=='string' && trim(lon)!='' ? +rad : NaN;
}
@stephenfeather
stephenfeather / gist:2ac42b8544c995f7b7ff
Created January 3, 2016 00:23
OSX command line for tool to test your android library for text relocations
/sdks/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-readelf -a yourlib.so | grep TEXTREL
@stephenfeather
stephenfeather / UIModule.m
Created July 1, 2016 13:19
textStyle hack
-(NSString*)TEXT_STYLE_TITLE1
{
if ([TiUtils isIOS9OrGreater]) {
return UIFontTextStyleTitle1;
} else {
return UIFontTextStyleBody;
}
}
-(NSString*)TEXT_STYLE_TITLE2
@stephenfeather
stephenfeather / slackLogger.js
Last active October 27, 2016 20:59
Small library for Titanium to send info to a Slack webhook for 'remote logging' during development/testing
// Copyright 2016 Stephen Feather
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@stephenfeather
stephenfeather / Timings.js
Last active December 19, 2016 12:22
Quick and dirty timings libary, most definitely should not be used for engineering, medical, safety related usages.
/*
Requires Underscore
Basic Usage:
var Timing = require('Timing');
Timing.start('myLabel');
Timing.stop('myLabel');
Timing.getTime('myLabel');
@stephenfeather
stephenfeather / waze.js
Last active August 24, 2017 19:15
Appcelerator Titanium module for Waze
// Copyright Stephen Feather and other contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
04d13ee4564f01142758f002d6b3069e7bfccf6d6ed92b8352e4782c9ceedddac7a38ed4109da157c27888d4318552a3738a07ef9910ebc9e8c1bbdfc56aea4e4a
@stephenfeather
stephenfeather / LatLon.js
Last active November 14, 2018 18:00
GeoTools we use in Appcelerator Titanium (sourced from Chris Veness) http://www.movable-type.co.uk/scripts/latlong.html
/*jslint vars: true, sloppy: true, nomen: true, maxerr: 1000 */
function LatLon(lat, lon, rad) {
if (typeof(rad) == 'undefined') rad = 6371; // earth's mean radius in km
// only accept numbers or valid numeric strings
this._lat = typeof(lat)=='number' ? lat : typeof(lat)=='string' && lat.trim()!='' ? +lat : NaN;
this._lon = typeof(lon)=='number' ? lon : typeof(lon)=='string' && lon.trim()!='' ? +lon : NaN;
this._radius = typeof(rad)=='number' ? rad : typeof(rad)=='string' && trim(lon)!='' ? +rad : NaN;
}
@stephenfeather
stephenfeather / cleanup.zsh
Created April 21, 2019 00:49
Clean Up wasted space on osx
#!/usr/local/bin/zsh
echo "Updating Homebrew"
brew update
brew upgrade
brew cask upgrade
brew cleanup -s
brew doctor
brew missing
echo "Updating App Store Items"
mas outdated