This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const frRegionNames = new Intl.DisplayNames(["fr"], { type: 'region' }); | |
frRegionNames.of("US") // 👉 'États-Unis' | |
const enRegionNames = new Intl.DisplayNames(["en"], { type: 'region' }) | |
enRegionNames.of("US") // 👉 'United States' | |
const esRegionNames = new Intl.DisplayNames(["es"], { type: 'region' }) | |
esRegionNames.of("US") // 👉 'Estados Unidos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One-Liner to filter all empty values from an array | |
const words = ["Follow", undefined, "@martinratinaud", null, '', "now!"] | |
const sentence = words.filter(Boolean) | |
console.log(sentence.join(" ")) // Follow @martinratinaud now! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios, { AxiosRequestConfig } from 'axios'; | |
import { JSDOM } from 'jsdom'; | |
export default class Scraper { | |
public JSDOM = JSDOM; | |
constructor() {} | |
async getUrl(url: string, axiosConfig?: AxiosRequestConfig) { | |
const { headers, ...options } = axiosConfig || {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
video_compress() { | |
filename_without_extension="${input_file%.*}" | |
extension="${input_file##*.}" | |
output_file="${filename_without_extension}-compressed.${extension}" | |
ffmpeg -i "$input_file" -vcodec libx264 -crf 23 -acodec aac -strict -2 -movflags faststart "$output_file" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
.preheader { | |
display: none; | |
max-height: 0; | |
overflow: hidden; | |
visibility: hidden; | |
font-size: 0; | |
color: transparent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NEXT_PUBLIC_GTM_ID = process.env.NEXT_PUBLIC_GTM_ID; | |
const NEXT_PUBLIC_HOTJAR_ID = process.env.NEXT_PUBLIC_HOTJAR_ID; | |
import React from 'react'; | |
import Script from 'next/script'; | |
import Delayed from 'modules/Common/components/Delayed'; | |
export default function HeadTag() { | |
return ( | |
<> | |
{NEXT_PUBLIC_GTM_ID && ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter better list | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Add nb followers and following directly in feed | |
// @author Martin Ratinaud | |
// @match https://twitter.com/* | |
// @grant none | |
// ==/UserScript== |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git_clone_gist() { | |
# The URL of the gist is the first argument to the script | |
gist_url=$1 | |
# Use the GitHub API to get the name of the first file in the gist | |
gist_id=$(basename $gist_url) | |
api_url="https://api.github.com/gists/$gist_id" | |
json=$(curl -s $api_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useIntersection } from 'react-use'; | |
const App = () => { | |
const intersectionRef = React.useRef(null); | |
const intersection = useIntersection(intersectionRef, { | |
root: null, | |
rootMargin: '0px', | |
threshold: 1, |