This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bodyContents = htmlCodez.match(/(?:(?:\s|\S)*<body[^>]*>)((?:\s|\S)*)(?:<\s*\/\s*body\s*\>(?:\s|\S)+)/)[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Proto-classical Inheritence?? AMIDOINITRITE | |
function extend (clazz, superclass) { | |
clazz.prototype = new superclass; | |
clazz.superclass = superclass; | |
} | |
// So...looks like this is a stripped down version of YUI's Y.extend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROMPT='%{$fg_bold[red]%}➠ %{$fg_bold[yellow]%}%n%{$fg_bold[white]%}%p%{$fg_bold[white]%} of %{$fg_bold[blue]%}%m%{$fg_bold[white]%} in %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$fg[white]%}commands thee to %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install promised-io | |
var promised = require('promised-io/promise'); | |
// all of these async methods return an instance of promised.Promise | |
var filePromise = getFile('/foo.html') | |
, databasePromise = getDatabaseRecord('users/bentruyman') | |
, websocketPromise = establishWebsocketConnection(); | |
promised.all([filePromise, databasePromise, websocketPromise], function (arrayOfResolvedData) { | |
// all promises have been resolved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BAD: `return` shouldn't be used to control flow/execution | |
function loadProductData(query) { | |
if ($('body').hasClass('busy')) | |
return; | |
$.ajax( /*...*/ ); | |
} | |
// GREAT SUCCESS: Just do this instead (OMG duh!) | |
function loadProductData(query) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can we get something like this?? | |
var howManyRainbows = 'double'; | |
var rainbow = { | |
(howManyRainbows): true | |
}; | |
if (rainbow.double) { | |
alert('What does it mean?'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = true | |
(function bar () { | |
return false | |
}()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>My Web Page</title> | |
<meta charset="utf-8"> | |
<link href="/stylesheets/main.css" rel="stylesheet"> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Simple Pub/Sub Implementation for jQuery | |
* | |
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js) | |
* | |
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery. | |
*/ | |
(function( $ ) { | |
// Cache of all topics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @match http://*/* | |
// @match https://*/* | |
// ==/UserScript== | |
var style = document.createElement('style'); | |
style.textContent = [ | |
'pre { ', | |
' -webkit-tab-size: 2;', | |
' -moz-tab-size: 2;', |
OlderNewer