Skip to content

Instantly share code, notes, and snippets.

View jacomyal's full-sized avatar

Alexis Jacomy jacomyal

View GitHub Profile
@jacomyal
jacomyal / onClickNode.as
Created June 14, 2011 19:41
How to open an URL when clicking a node with SiGMa-core:
// To react a node clicking, you have to listen to the
// event InteractionControler.CLICK_NODES:
InteractionControler.addEventListener(InteractionControler.CLICK_NODES,onClickNodes);
function onClickNodes(e:ContentEvent):void{
// e is a ContentEvent, with an array containing the
// IDs of each node under the mouse cursor during the
// click:
var clickedNodeIDs:Array = e.content;
@jacomyal
jacomyal / index.html
Created June 15, 2011 12:10
HTML layout draft for StarGit
<html>
<head>
<style>
*{
margin: 0;
padding: 0;
font-family: Helvetica;
font-size: 8pt;
}
@jacomyal
jacomyal / .actionScriptProperties
Created July 26, 2011 08:00
Old SiGMa .actionScriptProperties file (with the good compiler options)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="SiGMa.mxml" projectUUID="efe51f0a-aca3-48c8-aee8-d6dd5e308dbc" version="6">
<compiler additionalCompilerArguments="-use-network=false" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
@jacomyal
jacomyal / OptionsPanel.as
Created August 4, 2011 08:44
SiGMa's OptionsPanel.as, open by default
/**
*
* SiGMa, the Simple Graph Mapper
* Copyright (C) 2010, Alexis Jacomy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@jacomyal
jacomyal / index.html
Created September 26, 2011 09:32 — forked from anonymous/index.html
SiGMa random example (HTML)
<!-- 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>
@jacomyal
jacomyal / index.html
Created September 26, 2011 09:32 — forked from anonymous/index.html
SiGMa random example (HTML)
<!-- 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>
@jacomyal
jacomyal / outDegreeToSize.js
Created March 26, 2012 20:57
sigma.js - How to programmatically adjust the size of the nodes based on the number of outbound edges
/*
Add the function to the public prototype :
*/
sigma.publicPrototype.outDegreeToSize = function() {
this.iterNodes(function(node){
node.size = node.outDegree;
}).draw();
};
/*
@jacomyal
jacomyal / reduceUsecases.js
Created May 17, 2013 13:54
When and how I mostly use Array.prototype.reduce.
/**
* 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 = [
@jacomyal
jacomyal / README.md
Created December 12, 2014 10:51
A problem with Function.prototype.bind polyfill

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');
@jacomyal
jacomyal / index.html
Last active October 15, 2018 09:43
GIPAD intro JavaScript
<html>
<head>
<title>Introduction au JavaScript</title>
</head>
<body>
<div id="root"></div>
<div id="form">
<input type="text" id="name-input" />