Skip to content

Instantly share code, notes, and snippets.

View premasagar's full-sized avatar

Prem Rose premasagar

View GitHub Profile
function extend(target/*, any number of source objects*/){
var i = 1,
len = arguments.length,
withPrototype = arguments[len-1] === true,
obj, prop;
target || (target = {});
for (; i < len; i++){
obj = arguments[i];
if (typeof obj === 'object'){
var arrayMethods = {};
Object.getOwnPropertyNames(Array.prototype).forEach(function(methodName){
arrayMethods[methodName] = Array.prototype[methodName];
});
<time datetime="2012-06-08" class="event-start-date">
<abbr title="June">JUN</abbr>
<span>8</span>
<span>2012</span>
</time>
.lanyrd-series-upcoming-conference time.event-start-date {
}
.lanyrd-series-upcoming-conference time.event-start-date abbr {
var windowSearch = window.location.search,
devMode = /^\?dev[\W\/]?/.test(windowSearch);
cmd(
devMode ? 'jquery.js' : 'jquery.min.js'
);
@premasagar
premasagar / octocat.svg
Created May 29, 2012 20:54 — forked from milligramme/octocat.svg
Github octocat avatar, SVG format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@premasagar
premasagar / gist:2659105
Created May 11, 2012 11:30 — forked from almost/gist:2659046
index.js that auto-loads other modules in same directory
var fs = require('fs'), path = require('path');
// Load all exported objects into a single module.
fs.readdirSync(__dirname).forEach(function (filename) {
var fullpath = path.join(__dirname, filename), resource,
module;
if (fullpath !== __filename && 'js' === fullpath.split('.').pop() && '.' !== fullpath[0]) {
module = require(fullpath);
exports[filename.split('.')[0]] = module;
[{"conference":{"hash_tags":["#asyncjs"],"twitter_account":"@asyncjs","api_urls":{"conference":"http://lanyrd.asyncjs.com/2012/asyncjs-kirin/"},"name":"[Async]: Introducing Kirin, a new mobile platform","end_date":"2012-02-23","url":"http://asyncjs.com/kirin/","short_url":"http://lanyrd.com/cgdgz","dates":"23rd February 2012","online_conference":false,"schedule_url":"","web_url":"http://lanyrd.com/2012/asyncjs-kirin/","place":{"name":"Brighton","woeid":"13911","place_type":"Town","web_url":"http://lanyrd.com/places/brighton/","slug":"brighton","api_url":"http://lanyrd.asyncjs.com/places/brighton/"},"start_date":"2012-02-23","tagline":"","slug":"asyncjs-kirin"},"attendees":[{"user":{"username":"ac94","name":"Aron","avatar_url":"http://a1.twimg.com/profile_images/750527058/tape_normal.png","twitter_id":"11131532","web_url":"http://lanyrd.com/people/ac94/","api_urls":{"user":"http://lanyrd.asyncjs.com/people/ac94/"}}},{"user":{"username":"premasagar","name":"Premasagar Rose","avatar_url":"http://a0.twimg.com/pro
@premasagar
premasagar / animLoopX.js
Created September 24, 2011 00:47 — forked from louisremi/animLoopX.js
Animation loop with requestAnimationFrame
// Cross browser, backward compatible solution
(function( window, Date ) {
// feature testing
var raf = window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame;
window.animLoop = function( render, element ) {
var running, lastFrame = +new Date;
@premasagar
premasagar / hasSearchParam.js
Created September 12, 2011 10:10
Detect search parameter in window location
function hasSearchParam(param, value){
var pattern = "^[\?&]" + param +
(typeof value === "undefined" ? "($|[=&])" : "=" + value + "($|&)");
return (new RegExp(pattern)).test(window.location.search);
}
// e.g. hasSearchParam("debug") on http://example.com?debug
// e.g. hasSearchParam("foo", "bar") on http://example.com?foo=bar
@premasagar
premasagar / ufo.js
Created September 12, 2011 09:49 — forked from jimpurbrick/ufo.js
An alien abductor for the asyncjs.com JavaScript Jungle.
jj.createCreature("ufo", function (creature) {
"use strict";
var captured = {},
positionFactor = 0.005,
$ = jj.jQuery,
SEARCH = 1,
CHASE = 2,
CAPTURE = 3,
RETURN = 4,