stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
import com.google.caliper.Runner; | |
import com.google.caliper.SimpleBenchmark; | |
import java.util.HashSet; | |
import java.util.TreeSet; | |
public class SetBenchmark extends SimpleBenchmark { | |
// If you add a main function, you can run it from your IDE. | |
public static void main(String[] args) throws Exception { | |
new Runner().run( |
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
<link rel="import" href="../ace-element/ace-element.html"> | |
<link rel="import" href="../core-input/core-input.html"> | |
<link rel="import" href="../paper-button/paper-button.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
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
r = new webkitSpeechRecognition; | |
r.continuous = true; | |
r.interimResults = true; | |
r.onresult = function(ev) { | |
console.log(ev.results[ev.results.length-1][0].transcript); | |
}; | |
r.start() |
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
# Start an HTTP server from a directory, optionally specifying the port | |
function server() { | |
local port="${1:-8000}" | |
open "http://localhost:${port}/" | |
# Set the default Content-Type to `text/plain` instead of `application/ | |
# And serve everything as UTF-8 (although not technically correct, this | |
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTP | |
} |
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
/* | |
Grep.js | |
Author : Nic da Costa ( @nic_daCosta ) | |
Created : 2012/11/14 | |
Version : 0.2 | |
(c) Nic da Costa | |
License : MIT, GPL licenses | |
Overview: | |
Basic function that searches / filters any object or function and returns matched properties. |
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
/* Cranium MVC | |
* A minimalist MVC implementation written for | |
* demonstration purposes at my workshops | |
* http://addyosmani.com | |
* Copyright (c) 2012 Addy Osmani; Licensed MIT */ | |
var Cranium = Cranium || {}; | |
// Set DOM selection utility |
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 timeUntil = { | |
inHours: function(d1, d2) { | |
return parseInt((d2.getTime()-d1.getTime())/(24*3600), 10); | |
}, | |
inDays: function(d1, d2) { | |
return parseInt((d2.getTime()-d1.getTime())/(24*3600*1000), 10); | |
}, | |
OlderNewer