Skip to content

Instantly share code, notes, and snippets.

View jeromeetienne's full-sized avatar

Jerome Etienne jeromeetienne

View GitHub Profile
@jeromeetienne
jeromeetienne / googl.html
Created June 25, 2017 16:02
goo.gl - url shortener - standalone example
<html>
<script type="text/javascript">
// https://developers.google.com/url-shortener/v1/getting_started
//
function load() {
// get your keys from here https://developers.google.com/url-shortener/v1/getting_started#APIKey
gapi.client.setApiKey('XXX-YOUR-KEY-GOES-HERE-XXXX');
@jeromeetienne
jeromeetienne / firebase-receiver.html
Created June 25, 2017 16:00
firebase - example - one webpage sending data to another
<script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
// YOUR CONFIG goes here - https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
};
var firebaseApp = firebase.initializeApp(config);
var rootRef = firebase.database().ref();
// Get a reference to the /users/ada node
var adaRef = firebase.database().ref("users/ada");
@jeromeetienne
jeromeetienne / peerjs-receiver.html
Last active November 6, 2022 11:00
peerjs example - standalone - one webpage sending data to another
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script>
<script type="text/javascript">
// https://github.com/peers/peerjs
// go here to get your own key
var peerjsPeer = new Peer({key: 'xxxYOURKEYGOESHERExxxx'});
peerjsPeer.on('open', function() {
console.log('My peerjsPeer ID is: ', peerjsPeer.id);
});
@jeromeetienne
jeromeetienne / worker-pool-worker.js
Last active June 8, 2017 12:30
Webworkers pool - Minimal standalone implementation
self.addEventListener('message', function(event) {
console.log('in worker - received event', event)
self.postMessage('started')
}, false);
<!-- Augmented Reality on the Web in 10 lines of html! https://github.com/jeromeetienne/ar.js -->
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
<script src="../build/aframe-ar.min.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs='sourceType: webcam;'>
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
@jeromeetienne
jeromeetienne / .block
Last active July 23, 2021 17:36
AR.js with a-frame - Augmented Reality in less than 10lines of html
license: mit
@jeromeetienne
jeromeetienne / index.html
Created December 12, 2016 13:48
StartupTHREE.js example
<script src='https://cdn.rawgit.com/jeromeetienne/startupthree.js/0.6.0/startupThree.js'></script>
@jeromeetienne
jeromeetienne / file-return2.js
Last active April 18, 2016 15:53
debugging babel-plugin-transform-jsdoced template and \n
// source testbed.js
/**
* A description
* @returns {Number} - a number
*/
function foo() {
return 2
}
// SOURCE generated by transform-jsdoc
@jeromeetienne
jeromeetienne / .profile_gitbranch
Created January 18, 2016 20:01
include current git branch in your bash config
# to add the git branch in the prompt
__git_ps1(){
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf "(%s)" "${b##refs/heads/}";
fi
}
export PS1='\u@\h:\w$(__git_ps1 " (%s)")\$ '
@jeromeetienne
jeromeetienne / lossy-compression-for-json-model.js
Last active August 29, 2015 14:27
lossy compression for 3d models in json - 10min compression algo
var data = {
foobar : 1234.56789 // NOTE: see the number
}
data = JSON.parse(JSON.stringify(data, function(key, value){
if( typeof(value) !== 'number' ) return value;
// for number, keep at most 6 digits after dot
return Number( value.toFixed(6) )
}))