List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
#!/bin/bash | |
file=$PWD/audit.md | |
[ -f $file ] && rm $file | |
repos=$(find . -name package.json | grep -v node_modules) | |
echo "# Repository Audit $(date)" >> $file | |
for repo in $repos | |
do |
#!/bin/bash | |
# | |
# Takes one argument - the name of the package | |
# | |
mkdir $1 | |
cd $1 | |
npm init -y | |
echo 'console.log("hello");'>> index.js | |
cat package.json |jq --argjson scripts '{"start": "node ./index.js"}' '.scripts += $scripts' > new_package.json |
#!/bin/bash | |
npm install | |
start() { | |
docker run -d --rm -p 5672:5672 rabbitmq | |
echo Waiting 5 secs.... | |
sleep 5 | |
} |
class DataCache { | |
constructor(fetchFunction, minutesToLive = 10) { | |
this.millisecondsToLive = minutesToLive * 60 * 1000; | |
this.fetchFunction = fetchFunction; | |
this.cache = null; | |
this.getData = this.getData.bind(this); | |
this.resetCache = this.resetCache.bind(this); | |
this.isCacheExpired = this.isCacheExpired.bind(this); | |
this.fetchDate = new Date(0); | |
} |
# Given a number write a function that finds all rotations of its digits. | |
# For example for 197 the output would be 197, 971, and 719. | |
# Rotation is first diget to the moved to the end | |
# Last diget moved to the start | |
num = 1973 | |
def rotate(num_str): | |
return num_str[-1] + num_str[0:-1] |
This is a little investigation into how to create Column Partitions in BigQuery.
CREATE TABLE test.Events(
id int64,
type string,
info string,
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
#!/bin/bash | |
git checkout master | |
git pull | |
git branch -m master main | |
git push -u origin main | |
git checkout main | |
echo "Go to the repo Settings > Branches > Default Branch. Change it to the new branch press [ENTER]" | |
read finished |