Hat tip to Clean Code by Robert C. Martin (Uncle Bob)
- Consistency
- Predictability
- Maintainability
- Readability
import localforage from 'localforage'; | |
import { useCallback, useEffect, useState } from 'react'; | |
type Setter = (value: any) => Promise<any>; | |
/** | |
* Usage example: | |
* | |
* const IS_DEV_KEY = 'is-dev'; | |
* |
killport() { | |
if [ -z "$1" ]; then | |
echo "Usage: killport <port>" | |
return 1 | |
fi | |
lsof -ti:$1 | xargs kill -9 | |
} |
#!/bin/bash | |
## Installation: Add to path and call with `dates` or `dates <directory>` | |
## Bard prompt: "write me a script to use exiftool to prefix mp4 filenames with their timestamps" | |
if [[ $1 ]]; then | |
echo "The first argument exists" | |
current_directory=$(pwd)/$1 | |
else |
Get-ChildItem "C:\Users\chris\Downloads" -Filter *.zip | | |
Foreach-Object { | |
$name = $_.Name | |
$folderName = $name.Split('.')[0] | |
$folderPath = "C:\Users\chris\Downloads\takeout-in\$folderName\" | |
echo "Processing $folderPath" | |
New-Item $folderPath -type Directory |
Run chromaui/action@v1 | |
Chromatic CLI v5.7.0 | |
https://www.chromatic.com/docs/cli | |
Fireline is a recent open source project of mine.
It's a series of drop-in Firebase Functions and React hooks that integrate with Stripe to add SaaS payments to web apps.
steps: | |
- name: 'gcr.io/cloud-builders/docker' | |
entrypoint: 'bash' | |
args: ['-c', 'docker pull us.gcr.io/$PROJECT_ID/flyerr:latest-$BRANCH_NAME || exit 0'] | |
- name: 'gcr.io/cloud-builders/docker' | |
args: | |
[ | |
'build', | |
'-t', | |
'us.gcr.io/$PROJECT_ID/flyerr:latest-$BRANCH_NAME', |
const flatten = require('./flatten'); | |
describe('flatten', () => { | |
it('should flatten deeply nested arrays of integers', () => { | |
const arrays = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12]]] | |
const expected = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; | |
expect(flatten(arrays)).toEqual(expected); | |
}); | |
}); |