1. Stop using .innerHTML = ''; when removing children to a DOM element.
On modern browsers it seems to be about 400× (!!) slower than this DOM-friendly method:
while (el.firstChild)
el.removeChild(el.firstChild);| FileSchema.method("getDownloadUrl", (cb) => { | |
| var options = { | |
| Bucket: "watchmecode-net", | |
| Key: this.name // <= "this" right here, points at the wrong thing!!! | |
| }; | |
| var s3 = new AWS.S3(); | |
| s3.getSignedUrl("getObject", options, cb); | |
| }) |
| import 'whatwg-fetch'; | |
| /** | |
| * Requests a URL, returning a promise | |
| * | |
| * @param {string} url The URL we want to request | |
| * @param {object} [options] The options we want to pass to "fetch" | |
| * | |
| * @return {object} An object containing either "data" or "err" | |
| */ |
| #Installing VirtualBox | |
| echo "Installing VirtualBox........................" | |
| sudo apt-get install virtualbox | |
| #Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/ | |
| echo "Installing kubectl..........................." | |
| wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl | |
| chmod +x kubectl | |
| sudo mv kubectl /usr/local/bin/kubectl |
| from collections import defaultdict | |
| D=defaultdict(list) | |
| def addedge(a,b): | |
| D[a].append(b) | |
| D[b].append(a) | |
| addedge(1,2) | |
| addedge(2,3) |
| (defn breadth-first-search [z] | |
| (letfn [(zip-children [loc] | |
| (when-let [first-child (zip/down loc)] | |
| (take-while (comp not nil?) | |
| (iterate zip/right first-child))))]) | |
| (loop [ret [] | |
| queue (conj clojure.lang.PersistentQueue/EMPTY z)] | |
| (if (seq queue) | |
| (let [[node children] ((juxt zip/node zip-children) (peek queue))] | |
| (recur (conj ret node) (into (pop queue) children))) |
| module.exports = function(options) { | |
| var el | |
| , a | |
| , i | |
| if (!options.tagName) { | |
| el = document.createDocumentFragment() | |
| } | |
| else { | |
| el = document.createElement(options.tagName) | |
| if (options.className) { |
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |
| /* | |
| * WARNING: Mutates the fetchContext argument (by default the window or global context). | |
| * | |
| * A crude way to intercept fetch responses, and dispatch actions as needed. Using this | |
| * for more global app concerns, where I may want to dispatch actions depending on the response | |
| * status or body. e.g. When seeing a 401, dispatch a logout action. | |
| * | |
| * In most cases, I'd recommend using a middlware as shown in redux's real-world example. | |
| * (https://github.com/reactjs/redux/blob/master/examples/real-world/middleware/api.js) | |
| * |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |