Skip to content

Instantly share code, notes, and snippets.

View Babali42's full-sized avatar
🕸️
Go on drumbeatrepo make some noise

Baptiste Lyet Babali42

🕸️
Go on drumbeatrepo make some noise
View GitHub Profile
@Babali42
Babali42 / LinqLearn.cs
Last active November 27, 2024 10:11
Learn C# Linq Examples
//These code are easily convertible into linq version try them out
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitySC.PM.EME.Architecture.Test
{
[TestClass]
public class LinqDemoTests
{
@Babali42
Babali42 / FizzBuzzIterator
Created August 21, 2024 11:49
FizzBuzz in rust with Iterator
#[test]
fn shouldFizz() {
let mut fizz = [None, None, Some("fizz")].iter().cycle();
assert!(fizz.next().unwrap().is_none());
assert!(fizz.next().unwrap().is_none());
assert_eq!("fizz", fizz.next().unwrap().unwrap());
}
#[test]
fn shouldBuzz() {
main :: IO ()
main = do
putStrLn $ show $ fmap (fmap length) maybeNames
maybeNames :: [Maybe String]
maybeNames = [Just "Leblanc", Just "Juste", Nothing]
@Babali42
Babali42 / ScalaCheatSheet.md
Last active June 29, 2025 21:14
Scala cheat sheet

Scala Cheat Sheet

Naming convention

Generally speaking, Scala uses “camel case” naming. That is, each word is capitalized, except possibly the first word

  • Classes/Traits/Objects are upper camel cased
  • Variables, Values and functions are lower camel case def add(a: Int, b: Int) = a + b

Types

Unit est l'équivalent de void en java Int est un type entier

@Babali42
Babali42 / DockerFile devcontainer settings file for scala play application
Last active December 4, 2024 09:09
devcontainer settings file for scala play application
# Use an official Scala image as the base image
FROM ubuntu:latest
SHELL [ "/bin/bash", "-c"]
# Install java
RUN apt-get update && apt-get install -y curl zip unzip git-all && apt-get clean
RUN curl -s "https://get.sdkman.io" | bash
RUN source "$HOME/.sdkman/bin/sdkman-init.sh" \
&& sdk install java 19.0.2-tem \
&& sdk install sbt 1.8.2 \
# Use an official Scala image as the base image
FROM sbtscala/scala-sbt:graalvm-ce-22.3.3-b1-java17_1.10.1_3.4.2 AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the project files into the container
COPY . .
# Compile the application and create a distribution package

CLI for mongoDB

Start mongosh in admin mongosh --username="admin"

Go to the db use drum-beat-database

Insert a document db.beats.insertOne({"label":"Techno", "bpm":180})

@Babali42
Babali42 / HaskellCheatSheet.md
Last active July 10, 2025 09:54
Haskell Cheat Sheet

Haskell Cheat Sheet

Comment créer un programme :

main = do print "Hello World !"

Compiler le programme et exécuter l'exécutable

Glagow Haskell Compiler

@Babali42
Babali42 / typage.md
Created January 15, 2025 10:51
Introduction au typage par Gwennan

Le typage dans les langage de programmation

Statique vs dynamique

Typage dynamique

  • Le type peut changer au cours du temps

Typage statique

  • Ta variable a le même type tout le temps

Achever JVLIVS – sur JVLIVS III : Ad Finem de SCH

Par Romain de Becdelièvre et Fanny Taillandier Critique, Écrivaine

L’album JVLIVS III : Ad Finem vient conclure la tétralogie mafieuse de SCH initiée en 2018, et enterrer le double mafieux du rappeur. Plongée dans cet opus terminal à travers six punchlines, comme six roses déposées sur la tombe d’un avatar vibrant. Le roi est mort, vive le rap.

« J’pourrais écrire un livre sur ma vie » (« Stigmates »)