This file contains 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
const getErrorMessage = (response?: Response): string => { | |
const fallbackMsg = 'an unknown error'; | |
if (!response) { | |
return fallbackMsg; | |
} | |
const code = typeof response.status === 'number' ? response.status : ''; | |
const status = `${code} ${response.statusText || ''}`.trim(); | |
return status ? `status code ${status}` : fallbackMsg; |
This file contains 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
version: 2 | |
updates: | |
- package-ecosystem: npm | |
directory: / | |
schedule: | |
interval: weekly | |
day: "saturday" | |
time: "08:00" | |
groups: | |
patches: |
This file contains 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 { render as renderComponent } from '@testing-library/react'; | |
import userEvent from '@testing-library/user-event'; | |
type RenderArgs = Parameters<typeof renderComponent>; | |
export * from '@testing-library/react'; | |
/** | |
* Augments the RTL render with a userEvent user | |
*/ |
This file contains 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
/** | |
* Given color saturation and lightness percentages, | |
* returns a function that generates a unique css `hsl` | |
* color value for a given string. | |
*/ | |
const hashColor = (saturation: number, lightness: number) => ( | |
str: string, | |
): string => { | |
let hash = 0; | |
for (let i = 0; i < str.length; i++) { |
This file contains 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
#!/bin/bash | |
touch temp.text | |
lsof -n -i4TCP:$1 | awk '{print $2}' >temp.text | |
pidToStop=$( (sed '2q;d' temp.text)) | |
>temp.text | |
if [[ -n $pidToStop ]]; then | |
kill -9 $pidToStop | |
echo "Killed process $pidToStop running on port $1." | |
else |
This file contains 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
# rename all JS files in src/ to TS | |
find src -name '*.js' -exec bash -c 'git mv "$0" "${0%.js}.ts"' "{}" \; |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Adjacent hover highlight</title> | |
<style> | |
body { | |
font-family: sans-serif; | |
} |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Espresso Soda</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
This file contains 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
# git aliases | |
alias gs='git status' | |
alias ga='git add $1' | |
alias gb='git branch $1' | |
alias gcl='git clone $1' | |
alias gco='git checkout $1' | |
alias gm='git commit -m $1' | |
alias gma='git commit -am $1' | |
alias gph='git push' | |
alias gpl='git pull' |
This file contains 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
/* | |
Websockets using http://socket.io/ | |
Also with express web mvc framework http://expressjs.com/ | |
*/ | |
var app = require('express').createServer(), | |
io = require('socket.io').listen(app), | |
port = 88; | |
NewerOlder