Skip to content

Instantly share code, notes, and snippets.

View leobalter's full-sized avatar
💭
status

Leo Balter leobalter

💭
status
  • GitHub Staff
  • Bay Area, CA
View GitHub Profile
// From @littlecalculist
// http://twitter.com/#!/littlecalculist/status/89840539494662144
Function.prototype.build = function(a) {
return new (
this.bind.apply(this, [,].concat(a))
);
};
// Example constructor that "does things"
@leobalter
leobalter / array.goodies.js
Created July 10, 2011 01:38 — forked from rwaldron/array.extensions.md
Array goodies from twitter rap with David Herman, see wrap up here: http://twitter.com/#!/littlecalculist/status/89855977838485504
// http://twitter.com/#!/littlecalculist/status/89848378682392576
// http://twitter.com/#!/littlecalculist/status/89855977838485504
// Variable Arity Array.of()
Array.of = function() {
return [].slice.call( arguments );
};
console.log(
Array.of( "things", "that", "aren't", "currently", "an", "array" )
@leobalter
leobalter / placeholder.js
Created June 16, 2011 17:58 — forked from RamonPage/placeholder.js
Check placeholder support.
function supports_input_placeholder() {
var input = document.createElement('input');
return 'placeholder' in input;
}
var A = function(){};
A.prototype.foo = function(){
console.log('foo');
}
var B = function(){};
B.prototype.bar = function(){
console.log('bar');
@leobalter
leobalter / asshole.js
Created May 30, 2011 04:48 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*