This file contains 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
type Example = 'string'; | |
type Examples = Array<Example>; | |
// Option #1 | |
const examples: Array<Example> = ['example 1', 'example 2', 'example 3']; | |
// Option #2 | |
const examples: Example[] = ['example 1', 'example 2', 'example 3']; | |
// Option #3 |
This file contains 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-Style #1 | |
import fs from 'fs'; | |
import fetch from 'node-fetch'; | |
import User from '../shared/types/user'; | |
import Report from '../shared/types/report'; | |
import getUserById from '../shared/libs/get-user-by-id'; | |
import calculateDates from '../shared/libs/dates/calculate-dates'; | |
import validateUserDates from '../shared/libs/dates/validate-user-dates'; | |
import userPreferences from './constants/user-preferences.json'; | |
import getHeaderDates from './libs/get-header-dates'; |
This file contains 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
# You can use these two lines to identify | |
# required dependencies in your code, | |
# which need to be installed via NPM/yarn. | |
# Change to `grep -rnoE …` if you want to see | |
# the filepath and line number of the occurence. | |
grep -rhoE "from '\w+.*'|require\('\w+.*'\)" \ | |
src/scripts/ | sort | uniq |
This file contains 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
#!/usr/bin/env bash | |
# This script helps you to generate a new secure password. | |
# If you don't specify a number, the default length | |
# will be 32 characters. | |
# The following would give you a new password with 10 characters. | |
# newpw 10 | |
# NOTE: |
This file contains 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
#!/usr/bin/env bash | |
# Run this script, after you gave it a name like portfinder, added | |
# it to your path runtime and gave it an execution flag: | |
# portfinder 3000 | |
# Required system tools: | |
# bash, lsof and pwdx | |
if [[ -z $1 ]] |
This file contains 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
# Find out your current setting | |
xdg-settings get default-web-browser | |
# Find all available browsers on your system | |
grep -rl WebBrowser /usr/share/applications | |
# Example output of the command above: | |
# /usr/share/applications/google-chrome.desktop | |
# /usr/share/applications/firefox.desktop | |
# /usr/share/applications/webbrowser-app.desktop |
This file contains 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
# A handy tool to find out your current | |
# public IP address from the command line. | |
function public-ip { | |
IP=`curl -s icanhazip.com` | |
echo "Your public IP address is: ${IP}" | |
} | |
# Add it to your bash runtime like for example | |
# putting it into your .bashrc! |
This file contains 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
# Little tool for showing the current weather! | |
# Change DEFAULT_CITY to your favourite city. | |
# wttr // Resolves to wttr Hamburg | |
# wttr Sidney | |
# wttr "New York" | |
function wttr { | |
DEFAULT_CITY="Hamburg" | |
CITY="${1:-$DEFAULT_CITY}" |
This file contains 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
# If you call this function inside a git repository, | |
# this will open a compare page on Github. | |
function open-pr { | |
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | |
REPO=`git remote -v | grep fetch | awk '{print $2}'` | |
LINK=`echo $REPO | sed 's!git@!https://!' | sed 's!com:!com/!' | head -n1 | sed 's!\b\.git\b!!'` | |
# For Linux users: change `open` to `xdg-open` | |
open $LINK/compare/$BRANCH?expand=1 |
This file contains 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
# Tested on Ubuntu 16.04 and Bash 4.3.48 | |
# | |
# Usage: ./stitcher.sh $PWD 5 | |
# | |
# The stitcher shell script should be in the same directory, where you also find the images directory. | |
# Inside the images directory, I am assuming to find all the images for stitching. | |
# The first argument gives me an absolute path to the working directory. | |
# The second argument says, how many rows shall be rendered. | |
# In a directory with 20 images, this example would render 5 rows with 4 images in each row. | |
# The output can be found in output.jpg, in the same directory where this script is located. |
NewerOlder