Skip to content

Instantly share code, notes, and snippets.

View Boettner-eric's full-sized avatar
💻
Focusing

Eric Boettner Boettner-eric

💻
Focusing
  • hmbradley
  • Portland
  • 05:29 (UTC -07:00)
View GitHub Profile
@Boettner-eric
Boettner-eric / mr.sh
Created March 1, 2023 19:12
Create an MR from the command line
#!/usr/bin/env zsh
# - mr "title" "description"
# https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html
username='YOUR_USERNAME_HERE'
mrq='-o merge_request'
branch=$(git branch --show-current)
linearName=("${(@s/-/)branch}")
result=$(git push -u 2>&1 $mrq.create $mrq.target="master" $mrq.draft $mrq.title="[${linearName[1]:u}-${linearName[2]}] $1" $mrq.assign=$username)
parsed=$(echo $result | grep -Eo '(http|https)://[a-zA-Z0-9./?=_%:-]*' | tr -d '\n')
@Boettner-eric
Boettner-eric / gp.sh
Created March 1, 2023 19:14
Push to a branch and open the browser to that branch
#!/usr/bin/env zsh
command=$(git push 2>&1)
result=$(echo $command | grep -Eo '(http|https)://[a-zA-Z0-9./?=_%:-]*' | tr -d '\n')
open -a Arc $result;
@Boettner-eric
Boettner-eric / table_of_contents.tsx
Created May 1, 2023 21:00
React scrollable table of contents
import { useRef } from 'react';
enum ExampleEnum {
One = 'One',
Two = 'Two',
Three = 'Three',
}
export function ExampleComponent(props) {
const itemsRef = useRef<Map<ExampleEnum, HTMLDivElement>>(null);
@Boettner-eric
Boettner-eric / playlist.ex
Last active October 3, 2023 16:17
Write a spotify playlist to a text file
Mix.install([:httpoison, :poison])
defmodule Spotify do
[playlist_id] = System.argv()
@token_url "https://accounts.spotify.com/api/token"
@playlist_url "https://api.spotify.com/v1/playlists/#{playlist_id}"
def get_token() do
client_id = System.get_env("SPOTIFY_CLIENT_ID")