Skip to content

Instantly share code, notes, and snippets.

Damien Seguin dmnsgn

Block or report user

Report or block dmnsgn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View es-modules-in-the-browser-almost-now-sw.js
// Disclaimer: this is not stable nor properly tested
// Not sure about the security implications of hijacking the fetch request either
const ES_MODULE_IMPORT_REGEX = /\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/g;
const packages = new Map().set(
View es-modules-in-the-browser-app.js
import clamp from "lodash/clamp";
const num = Infinity;
const answer = clamp(num, 0, 42);
export default answer;
View package-name-maps.html
<!DOCTYPE html>
<title>ES modules in the browser - almost - now | Package name maps</title>
<!-- Declare the package map -->
<script type="packagemap">
View es-modules-service-worker.html
<!DOCTYPE html>
<title>ES modules in the browser - almost - now | Service worker</title>
// Register
View unpkg-getlibs.html
<!DOCTYPE html>
<title>ES modules in the browser - almost - now | unpkg getLibs</title>
<!-- Include the getlibs endpoint -->
<script src=""></script>
View basics-script-type-module.html
<!DOCTYPE html>
<title>ES modules in the browser - almost - now | Basics: script type module</title>
<!-- Use a type set to "module" with a fallback -->
<script type="module" src="app.js"></script>
dmnsgn / listAllEventListeners.js
Created Apr 5, 2017
List all event listeners in a document
View listAllEventListeners.js
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
dmnsgn /
Created Mar 28, 2017
Listen to all voices available by the `say` command on macOS
for voice in `say -v '?' | awk '{print $1}'`; do say -v "$voice" "Hi `whoami` my name is ${voice}"; done
dmnsgn /
Last active Jan 18, 2020
A collection of WebGL frameworks and libraries

A non-exhaustive list of WebGL frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • Filament: Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS and WASM/WebGL
  • ClayGL: A WebGL graphic library helping you to
dmnsgn / SingletonNoInstance.js
Created Apr 16, 2016
ES6 singleton pattern: prevent the creation of an instance
View SingletonNoInstance.js
// Implementation 4: prevent the creation of an instance
class SingletonNoInstance {
constructor(enforcer) {
throw new Error('Cannot construct singleton');
static singletonMethod() {
return 'singletonMethod';
You can’t perform that action at this time.