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
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
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
// 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
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
[alias] | |
# shortcuts | |
c = commit | |
co = checkout | |
cp = cherry-pick | |
f = fetch | |
# enhancements | |
d = diff -- ':!package-lock.json' ':!yarn.lock' # Do not show lock files when diffing | |
ds = diff --staged -- ':!package-lock.json' ':!yarn.lock' # Do not show lock files when diffing staged files |
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
name: optimal-post-on-twitter | |
on: | |
schedule: | |
- cron: '58 17 * * MON' # time adapted for NY timezone | |
- cron: '49 17 * * MON' | |
- cron: '32 13 * * TUE' | |
- cron: '58 17 * * TUE' | |
- cron: '49 21 * * TUE' | |
- cron: '32 13 * * WED' |
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
“Great people are those who make others feel that they, too, can become great.” | |
— Mark Twain | |
“Action is the universal language of success.” | |
— Dr. Steve Maraboli |
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 filter-branch --tree-filter "find . -name 'ops/roles/ota/files/.env' -exec sed -i -e \ | |
's/<thepasswordtoremove>/***REMOVED***/g' {} \;" | |
git reflog expire --expire=now --all && git gc --prune=now --aggressive | |
git push --force --all | |
# If this commit was hosted on github, you will still be able to access the failing commit on the web | |
# which is not what you want | |
# This is because GitHub needs to run garbage collection and this will be done manually upon request |
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 extractDomainName = (url:string) => { | |
const [extension, domain] = new URL(url).hostname.split('.').reverse(); | |
return `${domain}.${extension}`; | |
} | |