Skip to content

Instantly share code, notes, and snippets.

View sylvainSUPINTERNET's full-sized avatar
🗑️
:(){ :|: & };:

sylvainSUPINTERNET

🗑️
:(){ :|: & };:
View GitHub Profile
@sylvainSUPINTERNET
sylvainSUPINTERNET / test_async.js
Created January 9, 2019 10:19
async exemple with loader + timer
'use strict';
async function print(value) {
return new Promise((resolve, reject) => {
if(typeof value === 'string'){
setTimeout(() => resolve(value), 1000)
} else {
setTimeout(() => reject("string value param only."), 500)
}
@sylvainSUPINTERNET
sylvainSUPINTERNET / gist:364a2e2659f5d0f3ff94be380a586cd1
Created January 3, 2019 12:51
composer "Allowed memory size of XXX bytes exhausted"
$ php -d memory_limit=-1 /usr/local/bin/composer require your-package-name
@sylvainSUPINTERNET
sylvainSUPINTERNET / decompose-string.js
Created December 19, 2018 13:39
JS decompose string
'use strict';
let str = "salut";
for(let x=0; x < [...str].length; x++){
console.log([...str][x]);
}
@sylvainSUPINTERNET
sylvainSUPINTERNET / make_uuid.js
Created November 7, 2018 15:07
Generate uuid with Node.js with only crypto
'use strict';
const crypto = require("crypto");
module.exports = {
generateUuid: function(){
let randomVal1 = crypto.randomBytes(16).toString('hex');
let randomVal2 = crypto.randomBytes(16).toString('hex');
let currentDate = new Date().getTime();
'use strict';
function recursive(x){
console.log(x);
if(Math.sign(x) === 1){
//positiv given
if(x === 0){
//end
return 1;
@sylvainSUPINTERNET
sylvainSUPINTERNET / recursive.js
Created July 10, 2018 15:16
Basic recursive script for JS
'use strict';
function recursive(x){
console.log(x);
if(x === 0){ //end condition
//end
return 1;
} else {
//reset process until 0
@sylvainSUPINTERNET
sylvainSUPINTERNET / recursive.php
Last active July 10, 2018 14:43
Basic recursive usage
<?php
function recursiveCount()
{
//static to avoid reset of variable for each itterations
static $countMax = 5;
//On affiche
echo $countMax;
//On décrémente