Skip to content

Instantly share code, notes, and snippets.

View sharpred's full-sized avatar

Paul Ryan sharpred

View GitHub Profile
@sharpred
sharpred / add_bundle.rb
Created January 25, 2017 11:36
use cocoapods xcodeproj gem to add a file to your xcode project from the command line
require 'xcodeproj'
project_path = "./platforms/ios/helloWorld.xcodeproj"
project = Xcodeproj::Project.open(project_path)
#add the bundle as a reference
bundle_path = "../../includes/OTABundle.bundle"
bundleRef = project.new_file(bundle_path);
@sharpred
sharpred / tiappgrunt.js
Last active November 3, 2016 20:24
tiapp grunt example
/*
* set up a grunt config variable and create a couple of jobs to
* build and teardown your temp folder.
* the done/async stuff may be OTT but do no harm
*
* tasks/file1.js
*/
module.exports = function (grunt) {
grunt.config.set('tempfolder', process.cwd() + "/yourtempfolderhere");
@sharpred
sharpred / killLV.sh
Created June 14, 2016 13:40
kill liveview
#!/usr/bin/env bash
ps -e | grep liveview | awk '/titanium/ {print $1}' | xargs kill
@sharpred
sharpred / compatible-screens.xml
Created June 3, 2016 12:27
how to set your android app to exclude tablet size screens including nexus 6p / 5x / galaxy 6+7 edge
<compatible-screens>
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<screen android:screenSize="small" android:screenDensity="420" />
<screen android:screenSize="small" android:screenDensity="480" />
<screen android:screenSize="small" android:screenDensity="560" />
<screen android:screenSize="small" android:screenDensity="640" />
<screen android:screenSize="normal" android:screenDensity="ldpi" />
@sharpred
sharpred / saveamovie.js
Created June 8, 2015 08:10
save a movie
var movie = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'mymovie.mov');
var thumb = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'mymoviethumb.jpg');
Titanium.Media.showCamera({
success : function(event) {
var video = event.media;
if (movie.exists()) {
movie.deleteFile();
}
movie.write(video);
@sharpred
sharpred / deepHas.js
Created February 24, 2015 09:30
deep nested property
function propDeep(target, path, rtn) {
"use strict";
try {
target = target || {};
var result = eval("target." + path);
} catch(e) {
return false;
}
if (result) {
return rtn ? result : true;
@sharpred
sharpred / getContact
Created November 5, 2014 11:54
getContactByType
if (Alloy.CFG.theme === "meinetui") {
$.requestFN = "getContactByType";
Alloy.Globals.Api[$.requestFN]({
//can be 'general', 'mein-service', 'mein-service-excursions'
type : 'mein-service-excursions',
//excursionsId is ignored unless mein-service-excursions is used, in which case it is mandatory
excursionId: '1212'
}, $.successCallback, $.failedCallback);
}
@sharpred
sharpred / productBiscuits
Created September 15, 2014 14:40
productBiscuits
var images = {
"productBiscuits" : {
"boat" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/73B98337448B4A8B9F51888A7C7A8318/boat_73B98337448B4A8B9F51888A7C7A8318.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974249&Signature=%2Bew8AKJLxzIs8C6HgBCmp2jsHUQ%3D",
"camper" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/6B9CE162196A4455A77D128EAA9DF04D/camper_6B9CE162196A4455A77D128EAA9DF04D.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974407&Signature=r0CqD4bc%2BzBPZZmMfMT2IICL%2Fl0%3D",
"car" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/5031ADD80C014B16B7455B9132B6E998/car-hire_5031ADD80C014B16B7455B9132B6E998.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974445&Signature=2W8ix1a27Cit4rVvbvDGAzJsUcY%3D",
"extra" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/0906F231770D416EAAD822F8ADFB2821/extras_0906F231770D416EAAD822F8ADFB2821.pn
@sharpred
sharpred / gist:13cda452cab8348ef635
Created June 5, 2014 09:55
performs jshint on files in your commit
#!/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
pass=true
echo "\nValidating JavaScript:\n"
@sharpred
sharpred / gist:9069190
Created February 18, 2014 11:26
main.js change
(function() {
var Tabletop = require('tabletop');
var wrench = require('wrench');
var public_url = "https://docs.google.com/spreadsheet/pub?key=0ArTqrFjFwISadGI4anRRZlM4UGZrcjNTMTJ0OWsydkE&output";
var builder = require('xmlbuilder');
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var cwd;