Skip to content

Instantly share code, notes, and snippets.

@mynameislau
mynameislau / freeport.js
Last active February 26, 2017 16:50
Get automatically a free port on Express
const listener = app.listen(0, () => {
console.log(`Listening to port ${listener.address().port}`);
});
let name = 'Jean';
if (true) {
let name = 'Pierre';
console.log(name); // output : Pierre
}
console.log(name); // output : Jean
#FROM DAVID WALSH
# Delete every Docker containers
# Must be run first because images are attached to containers
docker rm $(docker ps -a -q)
# Delete every Docker image
docker rmi $(docker images -q)
@mynameislau
mynameislau / occlu.component.js
Last active May 12, 2023 17:00
Ambient occlusion component for AFRAME
// All three js imports can be found in the threejs github repository
import '../three/shaders/CopyShader';
import '../three/postprocessing/Effectcomposer';
import '../three/shaders/SSAOShader';
import '../three/postprocessing/RenderPass';
import '../three/postprocessing/ShaderPass';
const {
MeshDepthMaterial,
Clock,
<VirtualHost *:8080>
ServerName localhost
ServerAlias truc.127.0.0.1.nip.io
ServerAlias truc.*.127.0.0.1.nip.io
ServerAlias *.truc.127.0.0.1.nip.io
DocumentRoot "${WWW_ROOT}"
DirectoryIndex index.php
ErrorLog ${LOG_ROOT}/truc-error.log
CustomLog ${LOG_ROOT}/truc-access.log combined
/*********************** svg utils ************************/
//
// Function to create an optimized svg url
// Version: 1.0.6
@function svg-url($svg){
//
// Add missing namespace
//
@if not str-index($svg,xmlns) {
$svg: str-replace($svg, '<svg','<svg xmlns="http://www.w3.org/2000/svg"');
main -> stuff {% id %}
stuff -> itaStuff {% id %}
| textStuff {% id %}
textStuff -> text ita textStuff {% id %}
| text {% id %}
| null {% id %}
itaStuff -> ita text itaStuff {% id %}
# ne marche pas : erg*gregre**gregre*
main -> stuff
stuff -> delimitedStuff
| textStuff
textStuff -> text delimited textStuff
| text
| null
# one liner to easily download something and untar it
curl https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | tar -
xvJ --strip-components=1 --overwrite -C /usr/local/