Skip to content

Instantly share code, notes, and snippets.

@kerrishotts
kerrishotts / xhrjson.js
Created July 30, 2012 18:42
My XHR and JSON
PKUTIL.loadQueue = Array();
PKUTIL.XHRinProgress = false;
PKUTIL.XHRTimer = -1;
PKUTIL.load = function(theFileName, aSync, completion)
{
if (device.platform != "WinCE")
{
PKUTIL._load(theFileName, aSync, completion);
return;
@kerrishotts
kerrishotts / fileutil.js
Created August 6, 2012 06:58
HTML5 WC3 FILE API WRAPPER/PG FILE API WRAPPER
/*jshint asi:true, forin:true, noarg:true, noempty:true, eqeqeq:false, bitwise:true, undef:true, curly:true, browser:true, devel:true, smarttabs:true, maxerr:50 */
/******************************************************************************
*
* FILEUTIL
* Author: Kerri Shotts
*
* This library includes routines to deal with the FILE API, (which is... a bit
* painful.) The purpose of the library is to reduce the amount of work necessary
* to go through obtaining a file system, working with directories and files,
* etc. That isn't to say that we can eliminate callbacks or even callback
@kerrishotts
kerrishotts / easyCreate.shl
Created December 6, 2012 19:42
Sample wrapper around PhoneGap create command
#!/bin/bash
#
# this is a wrapper around PG's ./create command. It asks for
# each portion separately.
#
# Author: Kerri Shotts
# License: MIT
#
# Get the path to the PhoneGap installation
// based on and inspired by https://gist.github.com/1026439 and https://gist.github.com/3798781
//
// MIT license. Use however you'd like.
//
// first, define our macro for delaying our transition:
#define PKWaitDelay(dly, block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW,dly*100000),dispatch_get_current_queue(), ^{ block })
// then, inside your AppDelegate.m in didFinishLaunchingWithOptions:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.frame];
@kerrishotts
kerrishotts / UIBarButtonItem+Utility.h
Created February 18, 2013 20:13
UIBarButtonItem Utility: Quick & Dirty bar button item creation using Font Awesome, Text Attributes, and Background images.
// Author: Kerri Shotts
// MIT LIcense
#import <UIKit/UIKit.h>
@interface UIBarButtonItem (Utility)
+(UIBarButtonItem *) barButtonItemUsingFontAwesomeIcon: (NSString *)iconKey
target: (id)theTarget
action: (SEL)theAction
@kerrishotts
kerrishotts / gist:5061352
Created March 1, 2013 00:15
Tired of dealing with trying to get bold and/or italicized fonts out of iOS given only the font name? This should help.
// UIFont+Utility.h
// UIFont+Utility.[h|m] is (C) Kerri Shotts 2013, and released under an MIT license.
#import <UIKit/UIKit.h>
/**
*
* PKFontNormal = no modifications to the font; i.e., -Regular, -Roman, -Book, etc.
* PKFontBold = bold font desired (if possible); i.e., -Bold, -Black, -Heavy, etc.
* PKFontItalic = italic font desired (if possible); i.e., -Italic, -Oblique, etc.
@kerrishotts
kerrishotts / PKSOAP.js
Last active June 14, 2016 16:15
Simple SOAP library for JavaScript (PhoneGap Compatible), v0.1
/*jshint asi:true, forin:true, noarg:true, noempty:true, eqeqeq:false, bitwise:true, undef:true, curly:true, browser:true, devel:true, smarttabs:true, maxerr:50 */
/******************************************************************************
*
* SOAP
* Author: Kerri Shotts
*
* This library includes simple SOAP functions. MIT license.
*
*
* Usage is pretty straightforward:
@kerrishotts
kerrishotts / index.js
Created October 15, 2016 20:29
Battery Status example for phonegap forum post
function batteryStatus(z) {
alert ("level: " + z.level + "; isPlugged: " + z.isPlugged);
}
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners

ES2015 Modules