Skip to content

Instantly share code, notes, and snippets.

View tsbits's full-sized avatar
👾

Olivier Destenay tsbits

👾
View GitHub Profile
@tsbits
tsbits / socket-cheatsheet.js
Created October 19, 2017 16:53 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@tsbits
tsbits / [ThreeJS] Antialias
Last active November 22, 2016 15:02
[ThreeJS] Antialias
renderer = new THREE.WebGLRenderer({antialias: true});
@tsbits
tsbits / [ThreeJS] Transparent background
Last active November 22, 2016 14:56
[ThreeJS] Transparent background
renderer = new THREE.WebGLRenderer({alpha: true});
@tsbits
tsbits / [ThreeJS] Don't clear the canvas
Last active August 14, 2021 12:28
[ThreeJS] Don't clear the canvas
renderer = new THREE.WebGLRenderer({preserveDrawingBuffer: true});
renderer.autoClearColor = false;
@tsbits
tsbits / [Terminal & finder] config & alias
Last active December 5, 2016 11:24
[Terminal & finder] config & alias
// Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
// Reload Finder instances
killall Finder
// Show path in finder
Option + Command + P
// Show tab bar
@tsbits
tsbits / Normalize data to 0-1 range?
Created February 12, 2016 14:28
Normalize data to 0-1 range?
var v = (value-min)/(max-min) ;
@tsbits
tsbits / countryCode.txt
Created August 24, 2015 14:33
Country code
Afar => aa
Abkhazian => ab
Avestan => ae
Afrikaans => af
Akan => ak
Amharic => am
Arabic => ar
Assamese => as
Avar => av
Aymara => ay
@tsbits
tsbits / Terminal :
Created June 11, 2015 09:23
Open multiple slack on OSX Desktop
open -n /Applications/Slack.app
@tsbits
tsbits / main.js
Created April 13, 2015 09:20
Renaming an image sequence with nodeJS & fs
var fs = require('fs');
//That function list all the files in the directory.
//Loop all the file in the folder
//If the current object is a folder -> ignore it
//Else if the file name index of 'mairie' (the original image sequence file was named "mairie"+n, where n started at 200)
//rename it in "mairie"+i, to get an image sequence that begin at 0 and not 200
function getFiles (dir, files_){
files_ = files_ || [];
var files = fs.readdirSync(dir);
@tsbits
tsbits / app.js
Created February 6, 2015 12:00
Basic setup for Express + socket.io
// From http://stackoverflow.com/questions/9914816/what-is-an-example-of-the-simplest-possible-socket-io-example
var http = require('http'),
fs = require('fs'),
// NEVER use a Sync function except at start-up!
index = fs.readFileSync(__dirname + '/index.html');
// Send index.html to all requests
var app = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(index);