Skip to content

Instantly share code, notes, and snippets.

View stordahl's full-sized avatar
🤘
locked in

Jacob Størdahl stordahl

🤘
locked in
View GitHub Profile
@stordahl
stordahl / sanityClient.ts
Last active January 20, 2021 04:02
handy @sanity/client TypeScript module
import sanityClient from '@sanity/client';
type Client = {
projectId: string,
dataset: string,
token: string,
useCdn: boolean
}
// create instance of sanityClient
@stordahl
stordahl / githubWidget.js
Last active November 16, 2020 16:48
Simple Github Data Scriptable Widget for iOS14
const data = await getGithub()
const widget = createWidget()
Script.setWidget(widget)
Script.complete()
  
function createWidget(){
const w = new ListWidget()
w.backgroundColor = new Color('#1f1f1f')
w.useDefaultPadding()
@stordahl
stordahl / .bash_profile
Created January 18, 2021 20:27
kawaii bash prompt ^_^
export PS1='\[\e[0;97m\](=^_^=)\[\e[m\] \[\e[0;38;5;194m\]\d\[\e[0m\]:\[\e[m\] \[\e[0m\]\@\[\e[0m\]:\[\e[m\] \[\e[0;38;5;222m\]\w\[\e[m\] \[\e[0m\](\[\e[0;3;38;5;224m\]$(git branch 2>/dev/null | grep '"'"'^*'"'"' | colrm 1 2)\[\e[0m\])\[\e[m\] \[\e[0m\]#\[\e[0m\]:\[\e[m\] \[\e0'
@stordahl
stordahl / mergedById.ts
Last active February 28, 2021 03:10
a quick function to merge two arrays of objects where a child from one array share a value (like an ID) with a single child of the other array
// note: to use this function, replace '.id' in line 4
// with the property youre using to match children
const mergeById = (a1: Array<object>, a2: Array<object>) =>
a1.map(itm: object | null => ({
...a2.find(e: object | null => (e.id === itm.id)),
...itm
}))
@stordahl
stordahl / removeFirst.js
Created April 6, 2021 21:38
Removing DOM element from parent that loads onClick
window.addEventListener("DOMContentLoaded", function() {
const targetNode = document.getElementById('rpressModal')
const config = { attributes: true, childList: true, subtree: true };
const removeFirst = (e) => {
e.selectedIndex = "2";
}
const callback = function(mutationsList, observer) {
@stordahl
stordahl / getSchema.graphql
Created December 16, 2021 00:07
Run this query on your graphql server to get the schema
fragment FullType on __Type {
kind
name
fields(includeDeprecated: true) {
name
args {
...InputValue
}
type {
...TypeRef
@stordahl
stordahl / type.css
Created December 20, 2021 13:30
Responsive Typography Boilerplate
body {
--f-s-xl: clamp(3rem, 12vw + 1rem, 5rem);
--f-s-lg: 1.5rem;
--f-s-md: 1.25rem;
--f-s-sm: 1rem;
}
@media screen and (min-width: 40em){
body {
--f-s-lg: 2rem;
@stordahl
stordahl / install.sh
Created July 14, 2024 01:23
Buggy Install Script
#!/usr/bin/env bash
if [ "$1" = "--local" ]; then
echo "Building source..."
make build
sudo cp build/standup /usr/local/bin
echo "Installed local version of standup!"
exit 0
fi