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
| if (!Ext.isEmpty(window.URL) && Ext.isFunction(window.URL.createObjectURL)) { | |
| //Alors on va effectuer une requête ajax | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', url, true); | |
| xhr.responseType = 'blob'; | |
| xhr.onload = function(e) { | |
| //Et si tout s'est bien passé | |
| if (this.status == 200) { | |
| //Alors on construit un blob avec la réponse |
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
| function A (name) { | |
| this.name = name; | |
| this.sayMyName = this.sayMyName.bind(this); | |
| } | |
| A.prototype = { | |
| sayMyName: () => { | |
| console.log(this.name); // -> undefined | |
| } | |
| }; |
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
| /** | |
| * Utility function to create DOM element with populated attributes and content | |
| * | |
| * Usage : | |
| * | |
| * // simple element | |
| * let input = createDomElement("input", { | |
| * type: "search", | |
| * placeholder: "Enter what pleases you" | |
| * }); |
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
| let [a, b] = (new Array(2)).fill(Symbol()); | |
| console.log(a === b); // -> true |
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
| let canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas"); | |
| let context = canvas.getContext("2d"); | |
| canvas.width = window.innerWidth; | |
| canvas.height = window.innerHeight; | |
| context.drawWindow(window, 0, 0, canvas.width, canvas.height, "white"); | |
| console.log(` | |
| 📸 📸 📸 📸 | |
| ${canvas.toDataURL()} |
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 index = 0; | |
| var nodes = document.querySelectorAll(".tree-node"); | |
| function scrollNext() { | |
| index = index + 40; | |
| nodes[index].scrollIntoView(); | |
| if (index < nodes.length - 1) { | |
| requestAnimationFrame(scrollNext); | |
| } | |
| } | |
| scrollNext(); |
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
| git push git@github.com:user/repo local_branch_name:remote_branch_name |
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
| // With the console open, in the browser console: | |
| async function getOpenedConsoleReference() { | |
| var loader = Cu.import("resource://devtools/shared/Loader.jsm", {}); | |
| var {gDevTools} = loader.require("devtools/client/framework/devtools"); | |
| var target = await gDevTools.getTargetForTab(gBrowser.selectedTab); | |
| var toolbox = gDevTools.getToolbox(target); | |
| return toolbox.getCurrentPanel(); | |
| } |
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
| // With the console open, in the browser console: | |
| async function getOpenedConsoleReference() { | |
| var {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {}); | |
| var target = await devtools.TargetFactory.forTab(gBrowser.selectedTab); | |
| var {gDevTools} = devtools.require("devtools/client/framework/devtools"); | |
| var toolbox = gDevTools.getToolbox(target); | |
| return toolbox.getCurrentPanel(); | |
| } |
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_hg() { | |
| local HG_ROOT | |
| find_hg_root() { | |
| local dir="$( pwd )" | |
| while test $dir != "/"; do | |
| if test -f $dir'/.hg/dirstate'; then | |
| HG_ROOT=$dir"/.hg" | |
| return 0 | |
| fi |
OlderNewer