Skip to content

Instantly share code, notes, and snippets.

View joshjensen's full-sized avatar

Josh Jensen joshjensen

View GitHub Profile
@benbahrenburg
benbahrenburg / app.js
Last active March 15, 2017 14:20
example of app shortcuts
Ti.App.addEventListener("resume", function(){
Ti.API.info("Resume Event Fired");
});
Ti.App.addEventListener("resumed", function(){
Ti.API.info("Resumed Event Fired");
});
Ti.App.iOS.addEventListener("shortcutitemclick", function(e){
@benbahrenburg
benbahrenburg / app.js
Last active May 30, 2019 11:21
Titanium Spotlight Tests
var win = Titanium.UI.createWindow({
title:'Demo', backgroundColor:'#fff',layout:'vertical'
});
var btnSpotLightSupported = Ti.UI.createButton({
top:20, title:'Is SpotLight Supported?',
height:60, width:Ti.UI.FILL
});
win.add(btnSpotLightSupported);
find-up() {
local path=$(pwd)
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
done
if [ "$path" != "" ]
then
echo "$path"
fi
}
@jasonkneen
jasonkneen / sample.js
Last active August 29, 2015 14:01
DynamicLabel tag in Alloy - allows you to update a "value" and it applies it to a template. Place ui.js in your app/lib folder
$.recordCount.value = 99
@kennbrodhagen
kennbrodhagen / launch.rb
Created January 27, 2013 22:55
calabash-cucumber launch.rb that will not restart the iOS Simulator for each scenario but still restart the app itself each time.
########################################
# #
# Important Note #
# #
# When running calabash-ios tests at #
# www.lesspainful.com #
# this file will be overwritten by #
# a file which automates #
# app launch on devices. #
# #
@19h
19h / TiYoutube.js
Last active November 11, 2015 16:24
Titanium Mobile SDK iPhone / Android: Extract Youtube Video URL / URI from video-id / identification / name and play mp4 file. (Workaround for the recent change of security in Youtube)
Titanium.App.addEventListener("playvideo", function (e) {
var win11 = Titanium.UI.createWindow({
orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT],
title: "Video",
zIndex: 222222
});
var activeMovie = Titanium.Media.createVideoPlayer({
fullscreen: !0,
autoplay: !0,
@euforic
euforic / ti.socket.io.js
Created June 5, 2012 17:02
Socket.io-client Titanium
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <[email protected]> MIT Licensed */
/**
* Originally Ported to titanium by Jordi Domenech <[email protected]>
* source: https://github.com/iamyellow/socket.io-client
*/
this.io = {};
module.exports = this.io;
/**
@brandonkelly
brandonkelly / gist:2723569
Created May 18, 2012 06:31
Remove <script> tags from HTML
// Remove any <script> tags
// Go backwards to factor in nested script tags, e.g. <script>document.write('<script></script>')</script>
$offset = strlen($html) - 9; // Minimum match length is 9 chars (<script/>)
for ($offset; $offset >= 0; $offset--)
{
$substr = substr($html, $offset);
if (preg_match('/^<script[^>]+?\/>|^<script(?:.|\s)*?\/script>/im', $substr, $match))
{
$html = substr($html, 0, $offset).substr($html, $offset+strlen($match[0]));
}