Skip to content

Instantly share code, notes, and snippets.

View shazron's full-sized avatar
😆

Shazron Abdullah shazron

😆
View GitHub Profile
@shazron
shazron / gist:1167362
Created August 24, 2011 05:24
auto-ingest
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.net.ssl.HttpsURLConnection;
public class Autoingestion
{
@shazron
shazron / .bash_profile
Created September 28, 2011 01:08
Git Bash Completion (install git and bash-completion using homebrew)
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
GIT_PS1_SHOWDIRTYSTATE=1 #... untagged(*) and staged(+) changes
GIT_PS1_SHOWSTASHSTATE=1 #... if something is stashed($)
GIT_PS1_SHOWUNTRACKEDFILES=1 #... untracked files(%)
PS1='\h:\W \u$(__git_ps1 " \[\e[0;32m\](%s)")\[\e[1;37m\]$ '
@shazron
shazron / phonegap_geotest.html
Created September 29, 2011 18:40
Geolocation Test
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<!-- iPad/iPhone specific css below, add after your main css >
<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
@shazron
shazron / sim-run.sh
Created October 25, 2011 21:53
Run Xcode Simulator project from the command line
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@shazron
shazron / gist:1401563
Created November 28, 2011 19:08
PhoneGap Remove Notifications to JavaScript
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSString* jsString = [NSString stringWithFormat:@"MyFunction(%@)", [dict JSONString]];
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary* dict = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (dict && [dict isKindOfClass:[NSDictionary class]])
@shazron
shazron / github_comments.html
Created November 29, 2011 00:42
Github comments migrate to Apache JIRA
<!DOCTYPE html>
<html>
<head>
<!--
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
@shazron
shazron / gist:1725083
Created February 2, 2012 18:49
PhoneGap/Cordova: Open a url in the same UIWebView programmatically
function openInWebView(url)
{
var anchor = document.createElement('a');
anchor.setAttribute('href', url);
//anchor.setAttribute('target', '_self');
var dispatch = document.createEvent('HTMLEvents')
dispatch.initEvent('click', true, true);
anchor.dispatchEvent(dispatch);
@shazron
shazron / gist:1784253
Created February 9, 2012 23:33
window.requestFileSystem test
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, success, fail);
}
function success(fileSystem) {
alert("success");
}
function fail(evt) {
alert("fail");
@shazron
shazron / gist:2127546
Created March 19, 2012 22:07
iOS WebKit Database Locations

iOS WebKit Database Locations

"~" signifies the application's folder.

window.localStorage (4.3)

  1. ~/Library/WebKit/LocalStorage/file__0.localstorage
@shazron
shazron / create_project.sh
Created March 23, 2012 19:11
create_project.sh (Cordova)
#!/bin/bash
# ############################################################################
#
# MIT licensed
# http://www.opensource.org/licenses/mit-license.php
#
# Script to create a new PhoneGap project from the PhoneGap Template.
# You need to install PhoneGapLib first (through the installer)
# before this script can work.