Skip to content

Instantly share code, notes, and snippets.

View umaar's full-sized avatar

Umar Hansa umaar

View GitHub Profile
@umaar
umaar / utmstrip.user.js
Created May 21, 2011 17:15 — forked from paulirish/utmstrip.user.js
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.1
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
# Any Model
def to_s
name
end
def to_param
"#{id}-#{to_s.parameterize}"
end
@umaar
umaar / visibility.js
Created June 21, 2011 12:37 — forked from niallkennedy/visibility.js
Page Visibility API visibility test using jQuery
var isVisible = false;
function onVisible() {
isVisible = true;
jQuery.getScript("http://www.google-analytics.com/ga.js");
}
if ( document.webkitVisibilityState === undefined || document.webkitVisibilityState === "visible" ) {
onVisible();
} else {
jQuery.bind( "webkitvisibilitychange", function() {
.mouse, #preview{
position: absolute;
background-repeat: no-repeat;
height: 22px;
min-width: 15px;
z-index: 100;
}
.mouse{
background-image: url('../images/cursor.png');
@umaar
umaar / i18n.coffee
Created August 18, 2011 13:48 — forked from saschagehlich/i18n.coffee
Simple i18n with node.js and express.js
exports.I18n =
en:
title: "Free YouTube video download"
navi:
home: "Home"
howto: "Tutorial"
blog: "Blog"
termsofuse: "Terms of Use"
support: "Support"
imprint: "Imprint"
@umaar
umaar / LICENSE.txt
Created September 3, 2011 23:10 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@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