TODO
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
function logImageData(imageData, size = 0) { | |
const canvas = document.createElement("canvas"); | |
canvas.width = size || imageData.width; | |
canvas.height = size || imageData.height; | |
const ctx = canvas.getContext("2d"); | |
if (!ctx) throw new Error("Could not get 2d context"); | |
ctx.putImageData(imageData, 0, 0); | |
const dataURL = canvas.toDataURL(); | |
console.log( |
This file has been truncated, but you can view the full file.
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
<?xml version="1.0" encoding="UTF-8"?> | |
<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft" xmlns:viz="http:///www.gexf.net/1.1draft/viz"> | |
<meta/> | |
<graph defaultedgetype="directed"> | |
<attributes class="node"> | |
<attribute id="nodedef" title="nodedef" type="string"/> | |
<attribute id="occurrences" title="occurrences" type="integer"/> | |
<attribute id="rawSize" title="rawSize" type="string"/> | |
</attributes> | |
<attributes class="edge"> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft" xmlns:viz="http:///www.gexf.net/1.1draft/viz"> | |
<meta/> | |
<graph defaultedgetype="directed"> | |
<nodes/> | |
<edges/> | |
</graph> | |
</gexf> |
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
<html> | |
<head> | |
<title>Introduction au JavaScript</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<div id="form"> | |
<input type="text" id="name-input" /> |
I met an issue with the common polyfill for Function.prototype.bind
, found on the MDN, and I do not know where to fix it.
Here is the polyfill:
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
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
/** | |
* Here are the kind of cases I like to use Array.prototype.reduce to deal | |
* with: | |
*/ | |
/** | |
* We have an array of users sorted by name. The "reduce" method can be really | |
* useful here: | |
*/ | |
var users = [ |
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
/* | |
Add the function to the public prototype : | |
*/ | |
sigma.publicPrototype.outDegreeToSize = function() { | |
this.iterNodes(function(node){ | |
node.size = node.outDegree; | |
}).draw(); | |
}; | |
/* |
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
<!-- Button to generate random graphs --> | |
<button id="random" type="button" onclick="feedSiGMa();">Click to generate a random graph</button> | |
<!-- SiGMa --> | |
<div id="SiGMa-container" style="height:400px;width:100%;"> | |
<object id="SiGMa-client" style="width:100%;height:98%;border:1px #866 solid;"> | |
<param name="movie" value="/static/sigma-random/sigma.swf?configPath=/static/sigma-random/config.json"/> | |
<param name="allowScriptAccess" value="always"/> | |
<embed src="/static/sigma-random/sigma.swf?configPath=/static/sigma-random/config.json" allowScriptAccess="always"> | |
</embed> | |
</object> |
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
<!-- Button to generate random graphs --> | |
<button id="random" type="button" onclick="feedSiGMa();">Click to generate a random graph</button> | |
<!-- SiGMa --> | |
<div id="SiGMa-container" style="height:400px;width:100%;"> | |
<object id="SiGMa-client" style="width:100%;height:98%;border:1px #866 solid;"> | |
<param name="movie" value="/static/sigma-random/sigma.swf?configPath=/static/sigma-random/config.json"/> | |
<param name="allowScriptAccess" value="always"/> | |
<embed src="/static/sigma-random/sigma.swf?configPath=/static/sigma-random/config.json" allowScriptAccess="always"> | |
</embed> | |
</object> |
NewerOlder