Skip to content

Instantly share code, notes, and snippets.

View jottenlips's full-sized avatar
:octocat:

John Ottenlips Franke jottenlips

:octocat:
View GitHub Profile
@jottenlips
jottenlips / delete-gh-repos.sh
Last active October 28, 2019 14:41
Delete GitHub Repos, Use cautiously
repos=(
"user/repo"
"user/repo1"
"user/repo2"
)
for i in "${repos[@]}"
do
:
curl -XDELETE -H 'Authorization: token yourtokenhere' "https://api.github.com/repos/$i ";
@jottenlips
jottenlips / list-repos-gist.sh
Created October 22, 2019 15:23
List all Github repos for a user
curl "https://api.github.com/users/username/repos?per_page=100" | grep -o 'git@[^"]*' | sed "s/.git//g" | sed "s/github.com://g"
@jottenlips
jottenlips / todo.sh
Last active December 10, 2019 20:52
Get all my todos
grep -rnw './' -e '//TODO:'
@jottenlips
jottenlips / ignore.sh
Last active November 8, 2022 18:05
Add a line to your .gitignore file.
ignore() {
echo "\n$1" >>.gitignore
echo "added $1 to .gitignore"
}
# use
# ignore .DS_STORE
@jottenlips
jottenlips / gitupstream.sh
Created October 2, 2020 21:59
Push to the upstream of your branch even if it does not exist remote.
alias branch='git symbolic-ref --short HEAD'
alias upstream='git push --set-upstream origin $(echo $(branch))'
# use
# cd some_project
# upstream
@jottenlips
jottenlips / react-pixel-vscode-find-replace.md
Created October 13, 2020 13:47
Replace all occurrences of px with ints for react projects to be fully compatible with react native

Find

'(\d.)px'

Replace

$1
@jottenlips
jottenlips / useDisableBodyScroll.js
Created January 6, 2021 15:46
react use-disable-body-scroll
import { useEffect } from 'react';
export const useDisableBodyScroll = (open) => {
useEffect(() => {
if (open) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
}
}, [open]);
@jottenlips
jottenlips / dna_cleaning_script.sh
Last active January 20, 2021 00:08
Script for Michael
#!/bin/bash
lowercase_remove_dash () {
sed -e 's/-//g' $1 | tr '[:upper:]' '[:lower:]'
}
find . -maxdepth 1 -regex '\./.*\.fsa' | while read file; do printf "%s\n" $(lowercase_remove_dash $file) > $file; done
@jottenlips
jottenlips / Haul With Expo React Native CRNA
Last active February 10, 2021 16:54
haul with expo react native crna
https://github.com/callstack/haul/issues/463#issuecomment-408922287
@jottenlips
jottenlips / xssharing_middleware.py
Last active April 14, 2022 01:44
Allow django templates to receive data from a popup that calls window.opener.postMessage
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = getattr(settings, "XS_SHARING_ALLOWED_ORIGINS", '')
XS_SHARING_ALLOWED_METHODS = getattr(settings, "XS_SHARING_ALLOWED_METHODS",
['POST', 'GET', 'OPTIONS', 'PUT'])
def xssharing_middleware(get_response):
def middleware(request):
response = get_response(request)
if response.has_header('Access-Control-Allow-Origin'):