Skip to content

Instantly share code, notes, and snippets.

View sroccaserra's full-sized avatar
🐿️

Sébastien Roccaserra sroccaserra

🐿️
View GitHub Profile
@sroccaserra
sroccaserra / instant_coding.p8
Created October 12, 2023 16:51
Préparation Instant Coding
pico-8 cartridge // http://www.pico-8.com
version 41
__lua__
local ground_y = 80
function _init()
init_mob()
end
function _draw()
@sroccaserra
sroccaserra / Start_a_node_js_kata.md
Last active January 19, 2022 07:51
Start a Node.js kata

It should take less that 3 mn (you can practice to go even faster than that), and give you a shareable public repository ready to write tests and have a linter ready for fast feedback. Now we can move on to the kata.

Project start:

$ mkdir bowling-kata
$ cd bowling-kata

Npm setup (pulled from shell history, Ctrl-R):

diff --git a/api/lib/domain/services/mail-service.js b/api/lib/domain/services/mail-service.js
index 0be37bb4d5..b030bb5321 100644
--- a/api/lib/domain/services/mail-service.js
+++ b/api/lib/domain/services/mail-service.js
@@ -338,7 +338,7 @@ function sendVerificationCodeEmail({ code, email, locale, translate }) {
};
if (locale === FRENCH_SPOKEN) {
- options.subject = translate(frTranslations['verification-code-email'].subject, { code });
+ options.subject = translate({ phrase: 'verification-code-email.subject', locale: 'fr' }, { code });
@sroccaserra
sroccaserra / awesome_nes_games.md
Last active April 9, 2024 11:44
Awesome NES Games
@sroccaserra
sroccaserra / awesome_gba_games.md
Last active May 24, 2023 18:19
Awesome Game Boy Advance Games

Awesome Game Boy Advance Games

image

Note: the list includes some SNES and NES GBA ports, mostly for historical reason. At the time, it was the best way to play these games on the go.

‡: Exclusive game.

See also :

  • [Awesome 16 bit Games][a16]
@sroccaserra
sroccaserra / Conway.hs
Last active December 17, 2020 17:10
Suite de Conway en Haskell
module Conway where
-- https://fr.wikipedia.org/wiki/Suite_de_Conway
-- 1211
-- Il y a trois éléments :
-- - la liste déjà traitée,
-- - le chiffre en cours de comptage,
-- - la liste restant à traiter
@sroccaserra
sroccaserra / start-tmux.sh
Created November 23, 2020 13:51
Créer une session Tmux spécifique à un projet
#!/usr/bin/env bash
session=pix
tmux start-server
tmux new-session -d -s $session -n edit
tmux select-pane -t 1
tmux send-keys "cd api;vim" C-m
tmux split-window -h -p 25
@sroccaserra
sroccaserra / Main.hs
Last active November 25, 2020 07:50
Read lines from file lazily in Haskell
main = do
lines <- fmap lines getContents
print $ process lines
process :: [String] -> [[Int]]
process = map processLine
processLine :: String -> [Int]
processLine = map read . words
@sroccaserra
sroccaserra / run_tests.sh
Created October 5, 2020 15:52
Run unit tests, then run all tests in tests/*, then report global status
status=0
npm run test:api:unit || status=1
for dir in $(find tests/* -maxdepth 0 -type d -not -path tests/unit)
do
npm run test:api:path -- $dir || status=1
done
exit $status
@sroccaserra
sroccaserra / sloc_in_time.sh
Last active September 20, 2020 15:10
Measure SLOC evolution in time
#!/usr/bin/env bash
branch="$(git rev-parse --abbrev-ref HEAD)"
dir=api
echo "Starting from branch: $branch"
commits_with_dates=()
function find_commits() {