Skip to content

Instantly share code, notes, and snippets.

View gre's full-sized avatar
3 cups required

@greweb gre

3 cups required
View GitHub Profile
@gre
gre / example.js
Created April 5, 2015 19:52
wip refactoring of glsl-transition
var baboon = require("baboon-image");
var lena = require("lena");
var createTexture = require("gl-texture2d");
var createTransition = require("./glsl-transition");
// from "glsl-transitions"
var CubeTransition = {
"id" : "ee15128c2b87d0e74dee",
"name" : "cube",
"owner" : "gre",
var raf = require("raf");
raf(function loop (t) {
raf(loop);
if (isVisibleInWindow(canvas)) return;
// ... do your consuming stuff
});
@gre
gre / reactjs_componentapi_cheatsheet.md
Last active August 29, 2015 14:19 — forked from spoike/reactjs_componentapi_cheatsheet.md
fork & simplified version of spoike's cheatsheet & without JSX syntax

ReactJS Component Cheatsheet

To create a ReactComponent:

ReactComponent React.createClass(object proto)

Basic example:

var TitleComponent = React.createClass({

// REQUIRED

@gre
gre / package.json
Created April 30, 2015 12:41
proxy lichess stream Server Sent Event
{
"name": "enhance-lichess",
"version": "1.0.0",
"dependencies": {
"event-stream": "^3.3.0",
"request": "^2.55.0"
}
}
const Physics = {
applyForce: function(x, y) { ... },
processEntity: function(entity) { ... }
};
export default Physics;
@gre
gre / cheatsheet.md
Last active August 29, 2015 14:21
virtual-dom & fluxx CheatSheet

virtual-dom

https://github.com/Matt-Esch/virtual-dom

var h = require("virtual-dom/h");
// h est similaire à React.createElement :

h("div.someClass", { title: "un attribut DOM", onclick: f, ... }, [
  h("a", { href: "url" }, "Ceci est un lien"),
@gre
gre / gen_graphs.sh
Last active August 29, 2015 14:22
A R lang script to generate SVGs of all graphs/*.r
# requirement: r
# on MacOS: install r with homebrew: http://stackoverflow.com/a/26457411/343892
cd ./graphs/ || exit 1;
for f in *.r; do
rcode=`cat $f`
name=${f%.*}
echo -e "svg('$name.svg')\n$rcode\ndev.off()" | r --vanilla 1> /dev/null || exit 1
done;
@gre
gre / random.r
Last active August 29, 2015 14:22
par(
mfrow=c(2,3),
mar=c(1,1,2,1),
mgp=c(1, 0.2, 0),
oma=c(0,0,2,0))
distributeCurve <- function (f, title, samples = 40000, drawSamples = 40) {
l <- c()
for (i in 0:samples) {
r <- f()
if (process.env.NODE_ENV !== "production")
document.write('<script src="//localhost:9241"></script>');
@gre
gre / proxy_flickr.go
Last active August 29, 2015 14:26
proxy of flickr images to workaround the CORS issue on images (can't draw them on canvas / webgl)
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
http.HandleFunc("/", GetImageFromFlickr)