Skip to content

Instantly share code, notes, and snippets.

View thegreyfellow's full-sized avatar
🏠
Working Remotely

Youssef Idmoussi thegreyfellow

🏠
Working Remotely
  • Rabat, Morocco.
  • 04:10 (UTC -12:00)
View GitHub Profile

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@tinogomes
tinogomes / pre-commit-complete
Last active March 24, 2021 13:59
Git Hook pre-commit to pass Rubocop and Brakeman on Rails application for validations
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1
#!/bin/bash
# Small utility to wait for port to open.
#
# usage:
# ./port-wait.sh hostname port [timeout=10]
#
# ex:
# ./port-wait.sh 127.0.0.1 3000
@akramsaouri
akramsaouri / gomodoro.go
Created September 18, 2017 21:18
Pomodoro implementation using go routines/channels.
package main
import (
"fmt"
"os"
"time"
)
type Pomodoro struct {
turnChan, shortBreakChan, longBreakChan, exit chan bool
@akramsaouri
akramsaouri / lazy-evaluation.js
Last active October 15, 2018 14:01
Lazy evaluation in JavaScript
function Let(f) {
let called = false
let v = null
return function () {
if(called) return v
console.log('evaluating.')
v = f()
called = true
return v
}
@akramsaouri
akramsaouri / react-lazy-img-io.ts
Last active July 24, 2024 04:19
⚛️ Lazy load images in React with IntersectionObserver.
import React, { useEffect, useRef, FunctionComponent, HTMLProps } from 'react';
import 'intersection-observer'; // if you want to include a polyfill
/**
* Returns an IntersectionObserver that loads the image
* when it is at least {threshold}*100 visible in the viewport.
*
* PS: Cached on the window for performance
*/
function getImageLoaderObserver(
@ChrisTitusTech
ChrisTitusTech / fixlocale.sh
Created October 27, 2020 21:51
Fix Locales in any distro
#!/bin/bash
echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
echo "LANG=en_US.UTF-8" | sudo tee -a /etc/locale.conf
sudo locale-gen en_US.UTF-8