Skip to content

Instantly share code, notes, and snippets.

View scorsi's full-sized avatar
😬
What if... hugh.. whatever

Sylvain Corsini scorsi

😬
What if... hugh.. whatever
  • Asobo Studio
  • France, Lille
  • 08:57 (UTC +02:00)
View GitHub Profile
@scorsi
scorsi / cleanData.js
Created November 29, 2018 12:58
Clean data and check for validity
function cleanData(data, authorizedData) {
if (typeof data === 'undefined')
throw new Error('data should not be undefined');
if (typeof data !== 'object')
throw new Error('data should be an object');
var ndata = {};
for (var filterName in authorizedData) {
if (Object.hasOwnProperty.call(authorizedData, filterName)) {
var filter = authorizedData[filterName];
if (Object.hasOwnProperty.call(data, filterName)) {
@scorsi
scorsi / clone.js
Created November 29, 2018 12:57
Clone object JS
function clone(obj) {
if (obj === null || typeof obj === 'undefined' || typeof obj !== 'object') return obj;
cloned = {};
for (key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
cloned[key] = clone(obj[key]);
}
}
return cloned;
}
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker image rm -f $(docker images -q)
#!/bin/sh
### BEGIN INIT INFO
# Provides: smartalog
# Required-Start: networking postgresql nuukik-hazelcast mysql apache2 cups elasticsearch tomcat7
# Required-Stop: networking postgresql nuukik-hazelcast mysql apache2 cups elasticsearch tomcat7
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: smartalog
# Description: This file should be used to start and stop nuukik-hazelcast.
### END INIT INFO