View PrototypeChain.js
1 2 3 4 5 6 7 8 9 10
if (![].unique) {
Array.prototype.unique = function() {
var n = {}, r = [], i = 0, l = this.length;
for (; i < l; i++) {
if (this[i] && !n[this[i]]) {
n[this[i]] = true;
r.push(this[i]);
}
}
return r;
View osx-for-hackers.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
 
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
 
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
View bookmarklets.js
1 2 3 4 5 6 7 8 9 10
/**
CanIUse.com Helper - prompt for a keyword then display the correct caniuse.com page.
Save this as a bookmark in the Bookmark Bar for quick access to CanIUse.com pages.
NOTE: Use the minified version below for the URL of the bookmark.
**/
/** Minified:
* javascript:q=prompt("Search CanIUse.com for?")||0;q&&(location=encodeURI("http://caniuse.com/#search="+q));
**/
var query = window.prompt('Search CanIUse.com for?') || false;
if (query) location.href = 'http://caniuse.com/#search=' + encodeURIComponent(query);
View index.html
1 2 3 4
<form>
<input name="username" placeholder="username" />
<input name="password" type="password" placeholder="password" />
</form>
View nodejs-cheatsheet.js
1 2 3 4 5 6 7 8 9
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
 
 
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
 
View js-snippets.js
1 2
// Return absolute path without domain or protocol:
path = location.href.replace(/(.+\w\/)(.+)/,"/$2");
View Gruntfile.js
1 2 3 4 5 6 7 8 9 10
// Generated on 2013-09-24 using generator-webapp 0.4.1
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
 
// # Globbing
// for performance reasons we're only matching one level down:
View css-hacks-inputs.css
1 2
/* Eliminate glow on input fields when focused */
input:focus { outline: none; }
View object.debug.js
1 2 3 4 5 6 7 8 9
/**
* author: "Joe Johnson (say2joe@gmail.com)"
* Debug any JavaScript Object by inserting this code into your main JavaScript file.
* After initiating debugging on an object (ex. myObj.debug();), your console will
* log the name of a [named] function and its execution time. This helps when tracing
* the stack method calls with many objects and method calls.
* Note: this most likely only works for WebKit-based browsers supporting fn.name.
* Also, you may copy-paste this into console before running any event-based logic.
**/
Something went wrong with that request. Please try again.