Skip to content

Instantly share code, notes, and snippets.

View edoubart's full-sized avatar

Édouard Barthélémy edoubart

  • Greater Paris Metropolitan Region
  • LinkedIn in/edoubart
View GitHub Profile
// Create a function that checks if a given string is a palindrome.
// A palindrome is text that reads the same forwards and backwards, disregarding puncation, spaces, etc.
const testStrings = [
"b",
"aba",
"abc", // FALSE
"abba",
"Race Car",
"Mr. Owl ate my metal worm",
@edoubart
edoubart / find-duplicates.js
Created March 22, 2019 21:49
Quick function that finds the duplicate values within an array, and return an array of these duplicate values.
const ARRAY = [ 1, 1, 2, 3, 4, 4, 5, 6, 6, 6 ];
function findDuplicates(array) {
let countDictionary = array.reduce((countDictionary, value) => {
return {
...countDictionary,
[value]: countDictionary[value] ? countDictionary[value] + 1 : 1
};
}, {});
@edoubart
edoubart / custom_vimrc
Created September 13, 2017 00:02
Vimlander
set background=dark
syntax on
colorscheme vividchalk
set guifont=Monaco:h20
set backspace=eol,indent,start
@edoubart
edoubart / .vimrc
Created August 27, 2017 17:56
My .vimrc file
" take indent for new line from previous line
set autoindent
" "dark" or "light", used for highlight colors
set background=dark
" how backspace works at start of line
set backspace=eol,indent,start
" use spaces when <Tab> is inserted
@edoubart
edoubart / postgres-cheatsheet.md
Created May 22, 2017 18:13 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@edoubart
edoubart / ping_pong.exs
Created March 6, 2017 19:38
Process ping pong using Elixir (spawning processes, sending/receiving messages and Tasks)
# Define a PingPong module.
defmodule PingPong do
# Attribute
@game_finish 11
# Define a ready function to receive messages from other processes.
def ready do
# Handle each message.
receive do
{_sender, _action, @game_finish} ->
@edoubart
edoubart / introrx.md
Created February 21, 2017 23:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing