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
/** | |
* Force directed graph layout algorithm according to Fruchterman and Reingold's principle. | |
* The algorithm can be summarized as follows: | |
* algorithm SPRING(G:graph); | |
* place vertices of G in random locations; | |
* repeat N times | |
* calculate the force on each vertex; | |
* move the vertex c4 | |
* draw graph on canvas, plotter or any drawing tool. | |
* |
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
<?php | |
function toString($value) { | |
if ($value === TRUE) return 'TRUE'; | |
if ($value === FALSE) return 'FALSE'; | |
if ($value === null) return 'null'; | |
if (is_string($value)) return '"' . $value . '"'; | |
return $value; | |
} |
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
export interface Func<a, b> { | |
f: (_: a) => b | |
then: <c>(this: Func<a, b>, g: Func<b, c>) => Func<a, c> | |
repeat: (this: Func<a, a>) => Func<number, Func<a, a>> | |
repeatUntil: (this: Func<a, a>) => Func<Func<a, boolean>, Func<a, a>> | |
} | |
export let Func = <a, b>(f: (_: a) => b): Func<a, b> => { | |
return { | |
f: f, |
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 getLocalIP() | |
{ | |
var ip = []; | |
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection || false; | |
if (window.RTCPeerConnection) | |
{ | |
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){}; | |
pc.createDataChannel(''); | |
pc.createOffer(pc.setLocalDescription.bind(pc), noop); |
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
Show hidden characters
{ | |
"jsRules": { | |
"align": false, | |
"arrow-parens": false, | |
"arrow-return-shorthand": false, | |
"ban": false, | |
"ban-comma-operator": false, | |
"binary-expression-operand-order": false, | |
"class-name": false, | |
"comment-format": false, |
NewerOlder