Skip to content

Instantly share code, notes, and snippets.

View jeromeetienne's full-sized avatar

Jerome Etienne jeromeetienne

View GitHub Profile
@jeromeetienne
jeromeetienne / RafHijacker.js
Last active August 29, 2015 14:27
Overload RequestAnimationFrame to emulate a given framerate, or to hook callback pre/post every animation frames.
/**
* Hijack requestAnimationFrame. It can add preFunction or postFunction.
*
* @constructor
*/
var RafHijacker = function(){
var originalFct = requestAnimationFrame
var _this = this
this.preFunction = null
this.postFunction = null
@jeromeetienne
jeromeetienne / renderloop-vendor.js
Last active August 29, 2015 14:22
Rendering Loop ala vendor.js
// array of functions for the rendering loop
var onRenderFcts = [];
// Here you add your functions to the rendering loop.
// They will be executed in-order once per requestAnimationFrame()
onRenderFcts.push(function(now, delta){
// now is the absolute time in millisecond
// delta is the delay between now and the last iteration
// put your code here.
@jeromeetienne
jeromeetienne / NOTES.md
Created March 7, 2015 17:01
AR/VR Report
  • Virtual reality is about an other reality. Not like the actual reality that surround you.
  • Virtual reality is close to the scope of entertainment because it can display any reality even the fixtuous ones. Out goes from the realty displays in game. Level game. For games. Even gtav. We can imagine how the actual movie industry could use vR to display a new kind of movie
  • Augmented reality is about modifying our reality. The current works we live in. It is a way more profound change.
  • AR is more about utilities. VR is more about entertainment
  • Just trying to better understand the meaning of those words. Those concepts are very young. Their definitions is still very vague.
  • How to display it. Where is the screen for the user. Is there a single screens? Or two, one for each eye. Is it see thru display. Is it more normal opaque screen. Can user perceive depth
  • Relation between screen position and the latency issue to fool the brain
  • What reality is displayed? What is the type of content. Is it purely v
@jeromeetienne
jeromeetienne / README.md
Last active August 29, 2015 14:10
Description of jsdocFunction API

jsdocFunction

It ensures the jsdoc of your function is respected during execution. Check out the live demo.

API

var newFct = jsdocFunction(yourFct)
@jeromeetienne
jeromeetienne / consoleLogToScreen.js
Created September 25, 2014 13:55
console.log to screen - nice to debug mobile
//////////////////////////////////////////////////////////////////////////////////
// console.log to screen
//////////////////////////////////////////////////////////////////////////////////
;(function(){
var container = document.createElement('div')
container.dataset.name = 'consoleLogOnScreen'
container.style.width = '100%';
container.style.height = '100%';
container.style.position = 'absolute';
container.style.fontSize = '100%';
@jeromeetienne
jeromeetienne / multiline.js
Last active June 10, 2019 20:59
a snippet to have multi lines string in javascript.
var multilineString = (function(){ /*
this
is
a
multiline
string.
*/}).toString().split('\n').slice(1, -1).join('\n');
console.log(multilineString);
@jeromeetienne
jeromeetienne / gist:6030198
Created July 18, 2013 15:20
issue with sass compilation on tutorial examples
# it is a ```yo webapp``` followed by a ```grunt build --force```.
# There is issue with sass compilation
jeromeetienne@jmemacgpu:~/Downloads/yeoman-test/test2-webapp$ yo webapp
_-----_
| |
|--(o)--| .--------------------------.
`---------´ | Welcome to Yeoman, |
@jeromeetienne
jeromeetienne / testwebglinstpector.html
Created August 31, 2012 17:39
webgl instpect got a dependancy on domReady
<!doctype html>
<script src='http://benvanik.github.com/WebGL-Inspector/core/embed.js'></script>
<body><script>
// This is from Detector.js
// see https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js#L9
// It will display
// $ gotFunction true
// $ gotContext false
//
// So no context, aka WebGL not available...
@jeromeetienne
jeromeetienne / submsNow.js
Created August 25, 2012 09:56
a submillisecond version of Date.now() based on based on window.performance.now()
/**
* precise version of Date.now() -
* It provide submillisecond precision based on window.performance.now() when
* available, fall back on Date.now()
* see http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
*/
var nowSubms = (function(){
var p = window.performance || {};
if( p.now ) return function(){ return p.timing.navigationStart + p.now(); };
else if( p.mozNow ) return function(){ return p.timing.navigationStart + p.mozNow(); };
@jeromeetienne
jeromeetienne / README.md
Created July 16, 2012 08:15
coder fun: chained api going too far :)

The code you see below is a funny building of chained API :) it is a particle emitter for flame throwers. look at the running demo. I love the end of the flame. all in a single chained instruction. Recently i did all my libraries with chained api and i like it. the lib used below is fireworks.js. This particular emitter is a bit too much chained tho :)

but still i look at the size of the source and at the effect on the screen... you got a pretty cool looking effects for 60lines of javascript. maybe i should just break it in several instructions... would be artificial but hey :)

= a coder having fun