Skip to content

Instantly share code, notes, and snippets.

View jbailey4's full-sized avatar

Joshua Bailey jbailey4

View GitHub Profile
@3mcd
3mcd / parse-query-params.js
Last active December 16, 2015 03:48
Parse URL Query Parameters
function getQueryParameters(str) {
return (str || document.location.search)
.replace(/(^\?)/, '')
.split('&')
.reduce(function (a, x, i) {
var n = x.split('='), y = n[0], z = n[1];
try { z = JSON.parse(z); } catch(e) { }
a[y] = a[y] ? typeof a[y] == 'object' ? (a[y].push(z) && a[y]) : [a[y], z] : z;
return a;
}, {});
@3mcd
3mcd / phonegap-ios-7-status-bar-fix.m
Last active January 2, 2017 14:27
Place this snippet in the view controller (MainViewController, ChildBrowserViewController, etc) to push the view down 20px to account for the transparent iOS 7 status bar.
@implementation MainViewController
- (void)viewWillAppear:(BOOL)animated
{
// Lower screen 20px on iOS 7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.view bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 20;
self.webView.frame = viewBounds;