Skip to content

Instantly share code, notes, and snippets.

@idibidiart
idibidiart / readme.md
Created August 1, 2016 04:19 — forked from vizath/readme.md
SlimerJS on AWS EC2 with webgl support

There is not a lot of doc or posts about making an headless renderer with webgl support. Here are few of my findings

I tried things on Heroku, but I was not able to make anything work.

Next, I tried EC2 t2.micro, only to find out that OpenGL needs a graphic card to execute (sure, there are things like mesa that I didn't tried, but it looked like I needed to build Chrome and I didn't want to go that way).

The only easy solution that I found was AWS EC2 GPU Instances. They are pretty much overpriced for what I'm trying to acheive, but it worked. You need to use an AMI that support the Nvidia GRID thing. eg https://aws.amazon.com/marketplace/pp/B00FYCDDTE and its CentOS.

Slimer need Firefox and Firefox need shared libraries that we need to install (we will use a custom repo).

function rawAsap(task) {
if (!queue.length) {
requestFlush();
flushing = true;
}
// Equivalent to push, but avoids a function call.
queue[queue.length] = task;
}
var queue = [];
@idibidiart
idibidiart / graphql-relay-miracle-cure.md
Last active February 21, 2016 22:06
UI Blues Got You Down? Try GraphQL/Relay Miracle Cure! :D
@idibidiart
idibidiart / README.md
Created February 19, 2016 03:57 — forked from veltman/README.md
Gif rendering - SVG to GIF

Testing in-browser gif generation from an SVG with gif.js. Works in recent Chrome/Safari/Firefox.

Process:

  1. Create a standard SVG line chart.
  2. Step through in-between frames of the line chart: for each one, update the SVG, render to an image, add the image element to a stack of gif frames.
  3. Render frames together in the background using gif.js web workers.
  4. When rendering's complete, add the blob URL as an image and start the SVG on an infinite loop with d3.timer (gratuitous).

See also: Gif Globe, Gif New Jersey

@idibidiart
idibidiart / README.md
Created February 18, 2016 00:16 — forked from fabiovalse/README.md
Non-overlapping regions through collision detection
@idibidiart
idibidiart / GraphQL-Architecture.md
Last active September 16, 2023 18:36
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

@idibidiart
idibidiart / GraphQL-Relay-HN.md
Last active February 16, 2016 02:21
GraphQL/Relay
@idibidiart
idibidiart / dynamic-cursor
Last active May 7, 2017 13:18
Dynamic Cursor for Reagent
(ns main.hello
(:require
[clojure.walk :as walk]
[reagent.core :as r]))
(enable-console-print!)
; Advantages of Dynamic Cursor vs Reagent's own Cursor-as-function:
@idibidiart
idibidiart / sylvester.js
Created December 11, 2015 18:06
Vector and Matrix mathematics modules for JavaScript
// === Sylvester ===
// Vector and Matrix mathematics modules for JavaScript
// Copyright (c) 2007 James Coglan
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: