Skip to content

Instantly share code, notes, and snippets.

View remicmacs's full-sized avatar

remicmacs

View GitHub Profile

Keybase proof

I hereby claim:

  • I am remicmacs on github.
  • I am remicmacs (https://keybase.io/remicmacs) on keybase.
  • I have a public key ASAsR_hI11UMbJLsqPNFZdCZ9VHdf86Z7VZ6qlWTgSfDXAo

To claim this, I am signing this object:

/**
* Memo file for working with promises
* Sources :
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
* https://developers.google.com/web/fundamentals/primers/promises
*/
// Function reject that will be needed later
let rejectFunction = (err) => {
console.log('Failure ');
for( var j = 0; j < 5; j++ )
{
setTimeout ( function () {
console.log(j);
}, 1000);
@remicmacs
remicmacs / module.js
Last active December 7, 2017 08:59
Module pattern basics
/**
* Module pattern memo from www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html
*
*/
let MODULE = (function () {
// Variable that will hold the properties and methods of the modules
let my = {};
// Anything not attached to the returned object is private
const privateVariable = 'This is a privateVariable';
@remicmacs
remicmacs / subset.py
Created September 29, 2017 14:57
A little algo exercise to find the longest word that is a subset of a given string
import sys
def smallerGreater(refIndex, listIndex):
print( "smallerGreater function call :" , file=sys.stderr)
print( "refIndex = [", refIndex, "] listIndex = [", listIndex,"]" , file=sys.stderr)
if not listIndex : return None
listLen = len(listIndex)
if listLen == 1 :
onlyIndex = listIndex[0]
return onlyIndex if refIndex < onlyIndex else None
@remicmacs
remicmacs / most_wanted_commands_arch.sh
Last active August 25, 2017 15:00
A little bash snippet to know what are the commands I use the most often
history | awk '{print $4}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | sed -r '/^(\s|\t)+1(\s|\t)/d'