Skip to content

Instantly share code, notes, and snippets.

View maxpou's full-sized avatar
🌏
remote

Maxence Poutord maxpou

🌏
remote
View GitHub Profile
@maxpou
maxpou / composition.js
Created April 9, 2018 18:48
composition over inheritance
const canStar = state => ({
star() {
state.nbStar++
}
})
const canFork = state => ({
fork() {
state.nbFork++
}
@maxpou
maxpou / gist:2e8a9bc1f1f6e9c3f62c588b60f4482d
Created April 5, 2018 14:35 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@maxpou
maxpou / fabio-cross.js
Last active April 6, 2018 08:33
algorithm exercises
function fabioCross (n) {
const square = Array(n)
for (let rowIndex = 0; rowIndex < square.length; rowIndex++) {
square[rowIndex] = Array(n).fill(' ')
square[rowIndex][0] = '#'
square[rowIndex][square.length - 1] = '#'
if (rowIndex === 0 || rowIndex === square.length - 1) {
square[rowIndex] = Array(n).fill('#')
{"latitude": "52.986375", "user_id": 12, "name": "Christina McArdle", "longitude": "-6.043701"}
{"latitude": "51.92893", "user_id": 1, "name": "Alice Cahill", "longitude": "-10.27699"}
{"latitude": "51.8856167", "user_id": 2, "name": "Ian McArdle", "longitude": "-10.4240951"}
{"latitude": "52.3191841", "user_id": 3, "name": "Jack Enright", "longitude": "-8.5072391"}
{"latitude": "53.807778", "user_id": 28, "name": "Charlie Halligan", "longitude": "-7.714444"}
{"latitude": "53.4692815", "user_id": 7, "name": "Frank Kehoe", "longitude": "-9.436036"}
{"latitude": "54.0894797", "user_id": 8, "name": "Eoin Ahearn", "longitude": "-6.18671"}
{"latitude": "53.038056", "user_id": 26, "name": "Stephen McArdle", "longitude": "-7.653889"}
{"latitude": "54.1225", "user_id": 27, "name": "Enid Gallagher", "longitude": "-8.143333"}
{"latitude": "53.1229599", "user_id": 6, "name": "Theresa Enright", "longitude": "-6.2705202"}
@maxpou
maxpou / github-page-travis.md
Last active March 20, 2023 04:02
Auto deploy on GitHub Pages when commit on master (with TravisCI)

Auto deploy on GitHub Pages when commit on master (with TravisCI)

Repo side

  1. touch .travis.yml
  2. Copy paste the following
language: node_js
node_js: stable
export const testAction = (action, payload, state, expectedMutations, done) => {
let count = 0
// mock commit
const commit = (type, payload) => {
const mutation = expectedMutations[count]
try {
expect(mutation.type).toEqual(type)
if (payload) {
@maxpou
maxpou / heroes.js
Created June 23, 2017 09:13
heroes.js
var heroes = [
{ name: 'Wolverine', family: 'Marvel', isEvil: false, isTvShow: false },
{ name: 'Deadpool', family: 'Marvel', isEvil: false, isTvShow: false },
{ name: 'Magneto', family: 'Marvel', isEvil: true, isTvShow: false },
{ name: 'Charles Xavier', family: 'Marvel', isEvil: false, isTvShow: false },
{ name: 'Jessica Jones', family: 'Marvel', isEvil: false, isTvShow: true },
{ name: 'Daredevil', family: 'Marvel', isEvil: false, isTvShow: true },
{ name: 'The Punisher', family: 'Marvel', isEvil: false, isTvShow: true },
{ name: 'Luke Cage', family: 'Marvel', isEvil: false, isTvShow: true },
{ name: 'Batman', family: 'DC Comics', isEvil: false, isTvShow: false },
@maxpou
maxpou / main.js
Created June 12, 2017 16:36
composition over inheritance
const barker = (state) => ({
bark: () => console.log('Woof, I am ' + state.name)
})
const driver = (state) => ({
drive: () => state.position = state.position + state.speed
})
const murderRobotDog = (name) => {
let state = {
@maxpou
maxpou / Fizzbuzz.php
Last active November 16, 2016 13:42
Some Fizzbuzz implementations
<?php
// https://en.wikipedia.org/wiki/Fizz_buzz
// http://wiki.c2.com/?FizzBuzzTest
for ($i=0; $i < 200; $i++) {
echo printFizzzBuzz($i) . PHP_EOL;
echo printFizzzBuzzFunctionnal($i) . PHP_EOL;
echo printFizzzBuzzTernary($i) . PHP_EOL;
}
<?php
namespace Bim\Bam\BingoEnum;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
abstract class BeerErrorCode
{
const BARRELEMPTY = 4;
const SERVICESTOP = 8;