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 / 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

main :: IO ()
main = do
putStrLn $ show $ fmap (fmap length) maybeNames
maybeNames :: [Maybe String]
maybeNames = [Just "Leblanc", Just "Juste", Nothing]
@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() {
@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
{