Skip to content

Instantly share code, notes, and snippets.

@psiborg
psiborg / gist:1569699
Created January 6, 2012 08:30
JS Prototype - randomPick
if (!Array.prototype.randomPick) {
Array.prototype.randomPick = function() {
return this[Math.randomFromTo(0, this.length - 1)];
};
}
@psiborg
psiborg / gist:1569702
Created January 6, 2012 08:30
JS Prototype - randomFromTo
if (!Math.prototype.randomFromTo) {
Math.prototype.randomFromTo = function (lo, hi) {
return Math.round(Math.random() * (hi - lo)) + lo; // dilate then translate
};
}
@psiborg
psiborg / gist:1569704
Created January 6, 2012 08:31
JS Prototype - roundTo
if (!Number.prototype.roundTo) {
Number.prototype.roundTo = function (precision) {
var power = Math.pow(10, precision || 0);
return String(Math.round(this * power) / power);
};
}
@psiborg
psiborg / gist:1569706
Created January 6, 2012 08:32
HTML Base64 favicon (RIM)
<link href="data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@psiborg
psiborg / gist:1569715
Created January 6, 2012 08:33
JS Function Template
/* ===========================================================================
* $Id$
*
* @fileoverview
*
*
* @author Jim Ing (@jim_ing)
* ===========================================================================
*/
@psiborg
psiborg / gist:1569720
Created January 6, 2012 08:34
JS Object Template
/* ===========================================================================
* $Id$
*
* @fileoverview
*
*
* @author Jim Ing (@jim_ing)
* ===========================================================================
*/
@psiborg
psiborg / gist:1569722
Created January 6, 2012 08:34
PHP Script Template
<?php
/* ===========================================================================
* $Id$
*
* @fileoverview
*
*
* @author Jim Ing (@jim_ing)
* ===========================================================================
*/
@psiborg
psiborg / gist:1569723
Created January 6, 2012 08:35
PHP Object Template
<?php
/* ===========================================================================
* $Id$
*
* @fileoverview
*
*
* @author Jim Ing (@jim_ing)
* ===========================================================================
*/
@psiborg
psiborg / gist:1569726
Created January 6, 2012 08:35
HTML 5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="format-detection" content="telephone=no">
<title>Heading</title>
<link href="favicon.ico" rel="icon" type="image/x-icon">
@psiborg
psiborg / gist:1569729
Created January 6, 2012 08:36
HTML 5 Template (Inline)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no">
<title>Heading</title>
<link href="favicon.ico" rel="icon" type="image/x-icon">
<style type="text/css">
</style>