Skip to content

Instantly share code, notes, and snippets.

View umaar's full-sized avatar

Umar Hansa umaar

View GitHub Profile
@umaar
umaar / gist:2311111
Created April 5, 2012 13:47 — forked from anonymous/gist:2309745
Track Client-Side Errors with Google Analytics
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_setDomainName', 'yoursite.com']);
_gaq.push(['_addIgnoredRef', 'yoursite.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
@umaar
umaar / return-json-array
Created May 8, 2012 11:08
[play framework2.0] return json array.
public static Result list()
{
ObjectNode json = Json.newObject();
ArrayNode arr = json.arrayNode();
ObjectNode element1 = Json.newObject();
element1.put("title", 123);
element1.put("content", 123);
arr.add(element1);
@umaar
umaar / hideBar.js
Created June 3, 2012 00:15 — forked from JulesNeck/hideBar.js
Hide URL Bar for iOS and Android based on html5 mobile boilerplate
// Hide URL Bar for iOS and Android "level above next level"
// streamlined version without extension part
// slowly moving it to perfection...
MBP.hideUrlBar = function () {
if ( !location.hash ) {
doScrollTop = setInterval(function(){
@umaar
umaar / gist:3028940
Created July 1, 2012 16:50 — forked from msluyter/gist:1925069
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@umaar
umaar / twitter_streaming.js
Created July 18, 2012 13:58 — forked from ryanmcgrath/twitter_streaming.js
Access the Twitter Streaming API with ease (Node.js).
var util = require('util'),
http = require('http'),
events = require('events');
var Twitter = function(opts) {
this.username = opts.username;
this.password = opts.password;
this.track = opts.track;
this.data = '';
};
@umaar
umaar / htaccess
Created August 30, 2012 19:25 — forked from dave1010/htaccess
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
@umaar
umaar / touch.css
Created September 19, 2012 21:40 — forked from jlongster/touch.css
Web Audio API demo (iOS 6, Chrome) - The Web is a Platform
html, body {
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
canvas {
display: block;
margin: 0;
@umaar
umaar / touch.css
Created September 25, 2012 20:51 — forked from jlongster/touch.css
Web Audio API demo (iOS 6, Chrome) - The Web is a Platform
html, body {
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
canvas {
display: block;
margin: 0;
@umaar
umaar / touch.css
Created September 25, 2012 20:51 — forked from jlongster/touch.css
Web Audio API demo (iOS 6, Chrome) - The Web is a Platform
html, body {
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
canvas {
display: block;
margin: 0;
@umaar
umaar / life.js
Created October 15, 2012 21:25 — forked from simonlc/life.js
HTML5 Conway's Game of Life
// Conway's Game of Life for HTML5 Canvas
// By Simon Laroche
var FPS = 5;
var paused = true;
var gameStarted = false;
var gLoop;
var generations = 0;
var population = 0;