Skip to content

Instantly share code, notes, and snippets.

View jbouhier's full-sized avatar

JB Bouhier jbouhier

View GitHub Profile
@jbouhier
jbouhier / nestjs-decorators.md
Last active February 28, 2025 06:10
NextJS Decorators

NestJS Decorators

  • @Injectable(): Marks a class as a provider that can be managed by NestJS dependency injection system.
  • @Module(): Defines a module in NestJS, organizing the application structure.
  • @Controller(): Defines a basic controller in NestJS.
  • @Get(), @Post(), @Put(), @Delete(): HTTP method decorators for route handlers in controllers.
  • @Param(): Extracts parameters from the request.
  • @Body(): Extracts the entire body from the request.
  • @Query(): Extracts query parameters from the request.
  • @Headers(): Extracts specific headers from the request.
@jbouhier
jbouhier / js_cli_shorthand.zsh
Created November 22, 2023 17:08
JS pacakge manager CLI shorthand
# Automatically uses the package manager of current directory
# Just type "start" or any other scripts fo your package.json file
p() {
if [[ -f bun.lockb ]]; then
command bun "$@"
elif [[ -f pnpm-lock.yaml ]]; then
command pnpm "$@"
elif [[ -f yarn.lock ]]; then
command yarn "$@"
@jbouhier
jbouhier / software_engineer_projects_to_level_up.md
Created November 16, 2023 05:06
10 projects to level up as Software Engineer

10 projects to level up as a software engineer

RESTful API with Authentication and Authorization:

Develop a RESTful API using frameworks like Express or Django, incorporating authentication and authorization mechanisms to secure the endpoints.

Task Scheduling and Background Jobs with a Job Queue:

Implement a task scheduling system using a job queue like Bull or RabbitMQ, allowing asynchronous execution of tasks and background job processing.

Git Cherry pick - Cheat sheet

Cherry picking into branch2update

  • Copy hash of the commit you want git log
  • Switch to the branch you want to update: git checkout branch2update
  • From branch2update, create new branch: git checkout -b <new-branch>
  • Cherry pick commit: git cherry-pick <hash-of-wanted-commit>
  • Push new branch: git push --set--upstream origin <new-branch>
  • On Gitlab, open a MR into branch2update
@jbouhier
jbouhier / typescript_fix_package_types.md
Last active February 14, 2023 22:34
TypeScript extend type declaration of a module/package

TypeScript: Extend package types

// When a package doesn't have any types, we can silence TS with
import * as someLibrary from "some-library"

// And extend some types if we want better type safety
declare module "some-library" {
  export function missingFunctionDeclaration(): {
 x: number
# Docker compose
# Install: copy/pasta this into your .zshrc or .bashrc
alias dc='docker-compose'
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
alias dcl='docker-compose logs'
alias dcp='docker-compose ps'
alias dce='docker-compose exec'
alias dcr='docker-compose run'
@jbouhier
jbouhier / containers_id_list
Created July 6, 2016 10:59
List of Docker containers ID to simplify cleaning (i.e: docker rm)
docker ps -a | cut -d' ' -f1 | xargs | cut -c11-
@jbouhier
jbouhier / .curlrc
Created January 12, 2016 13:34 — forked from asmega/.curlrc
default proxy for curl in .curlrc
proxy=http://username:password@host:port