This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { makeAutoObservable } from 'mobx'; | |
import { observer } from 'mobx-react'; | |
import { createContext, useContext } from 'react'; | |
// ====== Stores ====== | |
/** Stores Pokemon Search information */ | |
class PokemonSearchStore { | |
name: string; | |
constructor() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Done purely in the browser console, using temp1 which is the input text as a Global Variable | |
// Might not give actual results, I started creating gists on day 2 and mostly recovered this from console history! 😆 | |
const text = () => temp1.textContent.split('\n') | |
const getFirstAndLastInteger = (str) => { | |
const integers = str.split('').map(s => Number(s)).filter(Boolean) | |
return Number(`${integers[0]}${integers[integers.length - 1]}`) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Done in browser console only | |
// Saved text input as Global Variable to access temp1 | |
const games = temp1.textContent.split('\n') | |
const regex = /(\d+) (green|red|blue)/g | |
const asObjects = games.map(game => [...game.matchAll(regex)].reduce((colors, matches) => { | |
const [_, number, color] = matches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Recursively evaluates generator values | |
function customAsync(generatorFn) { | |
const generator = generatorFn(); | |
const resolve = (generatorResult) => { | |
const noMoreIterations = generatorResult.done; | |
if (noMoreIterations) { | |
return Promise.resolve(generatorResult.value); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type LoggerProps = { | |
user: string; | |
status: string; | |
} | |
/** Generator function to log data, useful for understanding how yield works in generator calls */ | |
function* generateLogger({user, status}: LoggerProps) { | |
while (true) { | |
const data = yield; | |
console.log(`${Date.now()} -- ${status} ${user}: ${data}`) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run on bitbucket PR overview page for an idea of metrics: qty, authors, reviewers | |
function getPRAuthors(){ | |
return document.querySelectorAll('td.pull-request-author'); | |
} | |
function getPRReviewers(){ | |
return document.querySelectorAll('td.reviewers'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Short alias to allow automated copying of the 1password cli tool command 'op get somewebsite | jq ...' and then a timed clear on the gnome clipboard | |
# TODO: specify designation as an argument and maybe a command to open the website in chrome | |
pass=$(op get item $1 | jq -r '.details.fields[] | select(.designation=="password").value') | |
if [ -n "$pass" ] | |
then | |
echo $pass | xclip -selection clipboard | |
echo "Password was copied - clipboard will be wiped in 15 seconds" | |
sleep 15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from django.core.management.base import BaseCommand, CommandError | |
from django.apps import apps | |
class Command(BaseCommand): | |
help = 'Takes a model argument in the form of app_label.model_name and outputs all fields and values as JSON' | |
def add_arguments(self, parser): | |
parser.add_argument('model', nargs="1", help='A model argument in the form of app_label.model_name') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Prints a cutting list for all linear dims on a layout page - Rhino for Mac | |
Requires dims to be on unique layer name. Must also select the detail view that dim is scaled on to find scale factor. | |
''' | |
import Rhino | |
import scriptcontext | |
import System.Guid, System.Drawing.Color | |
import re | |
import rhinoscriptsyntax as rs | |
from collections import Counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>COACHELLA PICKER</title> | |
</head> | |
<body> | |
<script> | |
function randInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); |
NewerOlder