Skip to content

Instantly share code, notes, and snippets.

View Yago's full-sized avatar
👨‍💻

Yann Gouffon Yago

👨‍💻
View GitHub Profile
@Yago
Yago / func-named.js
Last active November 28, 2018 13:27
const sum = function sum() {
return [...arguments].reduce(function (acc, n) {
if (typeof n === 'number') return acc + n;
return acc;
}, 0);
}
sum(31,7,4); // return 42
// For recursion
const sum = function () {
return [...arguments].reduce(function (acc, n) {
if (typeof n === 'number') return acc + n;
return acc;
}, 0);
}
sum(31,7,4); // return 42
const addition = (i, j) => i + j;
function sum() {
return [...arguments].reduce(function (acc, n) {
if (typeof n === 'number') return acc + n;
return acc;
}, 0);
}
sum(31,7,4); // return 42
function sum() {
return [...arguments].reduce(function (acc, n) {
if (typeof n === 'number') return acc + n;
return acc;
}, 0);
}
@Yago
Yago / multiple-sort.js
Created December 14, 2017 13:48
Sort with a base and a secondary attribute
/**
* Sort with a base and a secondary attribute
*
* @param {Object} x - first object to compare
* @param {Object} y - second object to compare
* @param {string} m1 - base sort method
* @param {boolean} m1_asc - base method ascending
* @param {string} m2 - secondary sort method
* @param {boolean} m2_asc - secondary method ascending
* @returns {number} - sort comparison result
@Yago
Yago / dirtree.js
Created December 12, 2017 09:34
Recursive directory tree maker using only Node.js
const fs = require('fs');
const path = require('path');
// Valid file extensions
const valideExts = ['.md', '.html'];
// Recursive directory parser
const treeMaker = (dir) => {
return new Promise((resolve, reject) => {
const children = {};
@Yago
Yago / iOS10-11-emojis.yml
Last active November 14, 2017 10:24
Add [251] iOS 10/11 emojis (without tones) for Slack using Emojipacks (https://github.com/lambtron/emojipacks)
title: new_emoji
emojis:
- name: "male-police-officer"
src: "https://emojipedia-us.s3.amazonaws.com/thumbs/120/apple/76/male-police-officer_1f46e-200d-2642-fe0f.png"
- name: "female-police-officer"
src: "https://emojipedia-us.s3.amazonaws.com/thumbs/120/apple/76/female-police-officer_1f46e-200d-2640-fe0f.png"
- name: "male-sleuth"
src: "https://emojipedia-us.s3.amazonaws.com/thumbs/120/apple/76/male-sleuth_1f575-fe0f-200d-2642-fe0f.png"
- name: "female-sleuth"
src: "https://emojipedia-us.s3.amazonaws.com/thumbs/120/apple/76/female-sleuth_1f575-fe0f-200d-2640-fe0f.png"
@Yago
Yago / README.md
Last active September 13, 2017 08:54
Quickly setup your Toolbox environment

Usage

  1. You'll need few stuff to before starting :
  2. Put the toolbox-setup.sh in the place you want to create the Toolbox root directory
  3. $ sh toolbox-setup.sh
    • When VIM open ./toolbox-utils/tasks/prepare.js, replace on line 8 the rawgit value by your local served url (f.ex: http://localhost/toolbox/toolbox-reader/build)
  4. Then pick a toolbox project directory and start coding for the best
@Yago
Yago / History|-100e3135|entries.json
Last active May 18, 2022 11:22
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/yago/Sites/Personnal/faker/src/locales/fr/animal/crocodilia.ts","entries":[{"id":"Q9jJ.ts","timestamp":1652254930871},{"id":"VIQ6.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1652254933256}]}