This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PointerLockManager { | |
constructor(elem) { | |
this.elem = elem || document.body; | |
this.elem.addEventListener('click', this.lock.bind(this)); | |
document.addEventListener('pointerlockchange', this.onChangeHandler.bind(this)); | |
} | |
isLocked() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
var MEDIATOR_VUE = new Vue(); | |
var MEDIATOR = { | |
emit : MEDIATOR_VUE.$emit.bind(MEDIATOR_VUE), | |
on : MEDIATOR_VUE.$on.bind(MEDIATOR_VUE), | |
off : MEDIATOR_VUE.$off.bind(MEDIATOR_VUE), | |
once : MEDIATOR_VUE.$once.bind(MEDIATOR_VUE), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _get from 'lodash/get' | |
import _set from 'lodash/set' | |
import _cloneDeep from 'lodash/cloneDeep' | |
import _isArray from 'lodash/isArray' | |
/** | |
* A system to watch for changes on an object (with an API very simillar to VueJS watch mechanism) | |
* @param {Object} obj The object to watch changes on | |
* @return {Object} Return the proxied object, which you can modify like a normal object | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mergeUniforms } from 'three/src/renderers/shaders/UniformsUtils.js' | |
import { UniformsLib } from 'three/src/renderers/shaders/UniformsLib.js' | |
export default { | |
uniforms: mergeUniforms([ | |
UniformsLib.lights, | |
UniformsLib.fog, | |
]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Wraps an animation loop function so it can be executed at a specific frame-rate | |
* loop {Function} = The function you want to execute each frames | |
* fps {Number} = The desired frame rate | |
*/ | |
function createFpsCap(loop, fps = 60) { | |
let targetFps = 0, fpsInterval = 0; | |
let lastTime = 0, lastOverTime = 0, prevOverTime = 0, deltaTime = 0; | |
function updateFps(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0px; | |
font-size: 40px; | |
font-family: system-ui, sans-serif; | |
} | |
.my-newtab { | |
display: flex; | |
align-items: center; | |
justify-content: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script creates daily + monthly + yearly mysql database backups locally (on the same server) | |
# It DOESN'T notify you by email if an error happens, and DOESN'T store backups on a cloud service ! | |
# It DOES save a log file with the history of errors/success tho :) | |
# --- Edit those settings ! | |
mysqlDbUser='root' | |
mysqlDbName='database_name_here' | |
backupDirectory='/path/to/backups/directory' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A default linode web server does not have a lot of configuration done, | |
# those are important basic steps to perform in order to secure the server | |
# and also configure it properly ! | |
# update dependencies | |
apt update | |
apt upgrade | |
# define hostname and timezone | |
hostnamectl set-hostname example-hostname |