This file contains 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
$.each( buttons, function( propertyName, button ) { | |
$('<button>', { | |
html: button.label, | |
id: propertyName | |
}) | |
.bind('click', button.action) | |
.appendTo( 'nav' ); | |
}); |
This file contains 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 listenerIsActive = true, | |
requestFilter = { | |
urls: [ "<all_urls>" ] | |
}, | |
extraInfoSpec = ['requestHeaders','blocking'], | |
handler = function( details ) { | |
var headers = details.requestHeaders, | |
blockingResponse = {}; | |
This file contains 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
// Examples based on those given in | |
// "Avoiding The Quirks: Lessons From A JavaScript Code Review" | |
// by Addy Osmani | |
// http://addyosmani.com/blog/lessons-from-a-javascript-code-review/ | |
// Branching at runtime with memoization | |
// (wordy version) | |
var utils = { | |
getXHR: function() { |
This file contains 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 subject = "[Subject] is dead, long live [Subject]", | |
regex = /\[Subject\]/g; | |
while( regex.test(subject) ) { | |
subject = subject.replace( regex, subject ); | |
console.log( subject ); | |
} | |
// Warning... I killed node with this. | |
// FATAL ERROR: CALL_AND_RETRY_0 Allocation failed - process out of memory |
This file contains 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
do { | |
var m = 23; | |
} | |
console.log( typeof m ); // ??? |
This file contains 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
<div class="container"> | |
<style scoped> | |
p { color: red; } | |
</style> | |
<p>This paragraph has red text.<p> | |
</div> | |
<p>This paragraph does not.</p> |
This file contains 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
from flask import Flask | |
from flask import request | |
import git | |
import json | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_world(): | |
return "Hello, world!" |
This file contains 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 g = function () { console.log("var g = " + this.toString() + "; g.call(g);"); }; g.call(g); |
This file contains 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== | |
// @name RemoveYouTubeComments | |
// @description Remove bullshit YouTube comments. | |
// @match http://www.youtube.com/* | |
// @author Tim Branyen | |
// @version 1.0 | |
// ==/UserScript== | |
// Find the comments view element. | |
var commentsView = document.getElementById("comments-view"); |
This file contains 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 cluster = require("cluster"); | |
var os = require("os"); | |
var numCPUs = os.cpus().length; | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} |
OlderNewer