Skip to content

Instantly share code, notes, and snippets.

View ankjevel's full-sized avatar
🪱
Fear is the mind killer

Dennis Pettersson ankjevel

🪱
Fear is the mind killer
View GitHub Profile
{
"FERRARI": "FERRARI_CONFIG"
}
@ankjevel
ankjevel / pre-commit
Last active February 18, 2021 11:04
run prettier and eslint on pre-commit
#!/usr/bin/env bash
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
STAGED_ESLINT_FILES=$(echo "$STAGED_FILES"|grep -E "(ts|js)$")
STAGED_PRETTIER_FILES=$(echo "$STAGED_FILES"|grep -E "(ts|js|json|md)$")
BIN_DIRECTORY="$(git rev-parse --show-toplevel)/node_modules/.bin"
function eslint () {
if ! command -v ${BIN_DIRECTORY}/eslint &> /dev/null; then
exit 0
@ankjevel
ankjevel / search
Last active January 11, 2021 10:00
#!/usr/bin/env bash
token=xxx
org=Springworks
per_page=100
url="https://api.github.com/orgs/${org}/repos?per_page=${per_page}"
pages=$(curl -H "Authorization: token ${token}" --silent "${url}" -I | awk '$1=/Link:/ {print $4}' | sed 's/.*page=//' | sed 's/\>;//')
for page in $(seq 1 ${pages:-1})
do
for repo in $(curl -H "Authorization: token ${token}" --silent "${url}&page=${page}" | jq '.[] | select(.archived == false) | .ssh_url' | sed 's/\"//g')
@ankjevel
ankjevel / clear-cache.sh
Last active April 18, 2024 08:31
clear npm cache (when using nvm); run with `nvm list | clear-cache`
#!/usr/bin/env bash
function clear-cache {
versions=()
while read -r line; do
clean="$(echo ${line} | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g")"
valid=$(echo "${clean}" | grep '^[^a-zA-Z]' | grep -v 'system' | sed 's/->//' | sed 's/\s.*v//')
if [[ ! -z $valid ]]; then
versions+=(${valid})
[
{ "key": "ctrl+shift+up",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus" },
{ "key": "ctrl+shift+down",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus" },
{ "key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1" },
{ "key": "cmd+2",
{
"version": "0.1.0",
"command": "${workspaceRoot}/node_modules/.bin/mocha",
"isShellCommand": false,
"showOutput": "never",
"args": [],
"tasks": [
{
"taskName": "test",
"suppressTaskName": true,
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Debug",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/lib/index.js",
"stopOnEntry": false,
"args": [],