Skip to content

Instantly share code, notes, and snippets.

Avatar
🌏
remote

Maxence Poutord maxpou

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

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 Apr 6, 2018
algorithm exercises
View fabio-cross.js
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('#')
View customers.txt
{"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 Oct 18, 2020
Auto deploy on GitHub Pages when commit on master (with TravisCI)
View github-page-travis.md

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
View testAction.js
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) {
View 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 Jun 12, 2017
composition over inheritance
View main.js
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 Nov 16, 2016
Some Fizzbuzz implementations
View Fizzbuzz.php
<?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;
}
View enum.php
<?php
namespace Bim\Bam\BingoEnum;
use Symfony\Component\Validator\Exception\InvalidArgumentException;
abstract class BeerErrorCode
{
const BARRELEMPTY = 4;
const SERVICESTOP = 8;
You can’t perform that action at this time.