Skip to content

Instantly share code, notes, and snippets.

View Tuizi's full-sized avatar

Fabien Rogeret Tuizi

  • Montréal, Canada
View GitHub Profile
@Tuizi
Tuizi / 0 README.md
Last active July 11, 2024 07:25
Auth0 Token + React Router Loader

Use Auth0 JWT Tokens in React Router Dom Loaders

This README outlines the implementation details of passing JWT tokens in a React application using React Router. This is crucial for managing access controls and secure communication between the client and server.

Overview

The application utilizes React Router for navigation and Auth0 for authentication. The main focus is on how to effectively pass JWT tokens retrieved from Auth0 to various components and routes.

Technologies Used

@Tuizi
Tuizi / README.md
Last active September 28, 2023 12:21
Automated Dependency Updater with Tests: A Node.js script that updates npm packages in your project, runs tests, and reverts updates if tests fail. Generated with the help of ChatGPT by OpenAI.

Automated Dependency Updater with Tests

This Node.js script automates the process of updating your project's dependencies while also running tests to ensure that each update doesn't break your code.

Generated with the help of ChatGPT by OpenAI.

Features

  • Checks for outdated npm packages in your project.
  • Sorts the packages by update type (patch, minor, major).
@Tuizi
Tuizi / go.md
Last active December 10, 2018 19:40
Go - Cheat Sheet

Go Cheat Sheet

Array

array := []int{1, 2, 3, 4}

fmt.Println("Full array", array) // Full array [1 2 3 4]
fmt.Println("Skip 2 first", array[2:]) // Skip 2 first [3 4]
fmt.Println("2 first", array[:2]) // 2 first [1 2]
@Component({
selector: 'i-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
lang$: Observable<string>;
constructor(private readonly translate: TranslateService,
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/home/', '.json');
}
@NgModule({
imports: [
CommonModule,
HomeRoutingModule,
TranslateModule.forChild({
loader: {
<header>
<button (click)="lang.next('fr')">FR</button>
<button (click)="lang.next('en')">EN</button>
</header>
@Tuizi
Tuizi / app.module.ts
Last active September 21, 2017 14:12
ngx-translate multiple i18n files
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/app/', '.json');
}
@NgModule({
imports: [
/* ... */
HttpClientModule,
TranslateModule.forRoot({
loader: {
@Tuizi
Tuizi / test-helper.spec.ts
Last active March 19, 2021 19:47
MockStore for Angular ngrx/store unit tests
import { Action, ActionReducer, Store } from '@ngrx/store';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operator/map';
import { Observer } from 'rxjs/Observer';
// TODO: How to initialize those variables?
const dispatcherMock: Observer<Action>,
reducerMock: Observer<ActionReducer<any>>,
stateMock: Observable<any>;
@Tuizi
Tuizi / techno stack.html
Last active November 1, 2016 13:53
Techno Stack
<!DOCTYPE html>
<html>
<body>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABUAAAAL1CAYAAAAGpk5zAATYKnpUWHRteEdyYXBoTW9kZWwAALy8x47tSNA09jQDSJsBvVnS89B7t/lB773n04vs+RZaSBsJEnBP39M0xTJZmRGRyf4HZvqrqLv8HwjY13yhynzY/oHZfyBIHZ+66+J/IB79F3hP/29qnNbDNq7VPzD9/v4btrx7/38Pvz91+/0RvB8Q+F8g+L+w//39Sk1Tl/t5Itfb1wqM/wtjX0Oy6KjKPxDzfu/q9nu0kKft+N3CVMvY539X/wv8C+EE+i+IwO8JOy7ipf4/NQO9B498Wetx+K+/6L/4v9C/yH9n8qzexuW/E+d5/pst8flvPf53crun/L9T5TiW39ihf2DuH5jJ6rhc4v79BVeeYJ2DuK0DRCvy6/GqUdz4OCZRk8EAMAD/gejzB6E9nI4r9iiLva87dsGDpd9kSHHOcGPCew36vM/hT9GC08EgvHo20Rj+jjA0bpziZZwszRIIxZ7vQbg2guFWx9ogUFe9PPLIlO8wTi07TuDE2yAPXl7S5YFywNclhhG0pNF71IhKvXi/0AOGE+k7T3SG6gYOxuT7tXovyPKhGQTr/YakbFbNXx/ef8IYQN7yXpOnY1N+XS265zdjCoGi6n+XwE8lcVgSVtg7d/z+fp73U/IMjBLf9QAKE8775SCLArevbvhGIhZiqIQFwAIG9SzD1wusJfDEw5P3LK/tBYY377c7675evJ88/S46vmNlMNGAdNOMfes/9/wZ2NeN98n0Ny6yabL1+Osbbb4rylMgdBTnMgiF8a4+302gAcotOVz5DGSQPT3t4nAr6I3aezZ4R0ULWQRiEnJsOiFhG9GaX5c31Xh/ptj0XnC/nyLDWwH0Di3fv9Nl2kTF9Q6dvt7P/HyNWe1DFrbtXP5BsEhDEJfYXguO0EAViLOX0Df7XC71Nf
@Tuizi
Tuizi / speak.md
Last active October 27, 2016 20:06

English

var msg = new SpeechSynthesisUtterance('Hello! how are you today?');
msg.lang = 'en-US';
window.speechSynthesis.speak(msg);

French

var msg = new SpeechSynthesisUtterance("Bonjour, comment allez vous aujourd'hui?");