Skip to content

Instantly share code, notes, and snippets.

View HerbCaudill's full-sized avatar

Herb Caudill HerbCaudill

View GitHub Profile
@HerbCaudill
HerbCaudill / css-article-1.css
Last active October 7, 2020 12:28
css-article-1.css
.tabstrip__tab {
...
background: 'lightBlue';
}
.tabstrip__tab--active {
...
background: 'darkBlue';
}
@HerbCaudill
HerbCaudill / 3.jsx
Created October 7, 2020 12:29
css-article-3.jsx
let styles = css`
background: lightBlue;
border: 1px solid blue;
border-radius: 2px;
@:hover {
background: darkBlue;
}
}`
<div css={styles}>...</div>
@HerbCaudill
HerbCaudill / 4.jsx
Created October 7, 2020 12:30
css-article-4.jsx
let styles = {
background: 'lightBlue',
border: '1px solid blue',
borderRadius: 2,
'&:hover': { background: 'darkBlue' }
}
<div css={styles}>...</div>
@HerbCaudill
HerbCaudill / 5.jsx
Created October 7, 2020 12:30
css-article-5.jsx
let styles = {
background: 'lightBlue',
border: '1px solid blue',
borderRadius: 2,
}
<div style={styles}>...</div>
@HerbCaudill
HerbCaudill / 6.jsx
Last active October 7, 2020 12:33
css-article-6.jsx
<button class="ma4 bg-red white ph4 pv2 f6 shadow">
Click me
</button>
@HerbCaudill
HerbCaudill / 7.jsx
Created October 7, 2020 12:34
css-article-07.jsx
<button class="m-4 bg-primary text-white px-4 py-2 text-xs shadow-lg ">
Click me
</button>
@HerbCaudill
HerbCaudill / 8.jsx
Last active October 7, 2020 12:46
css-article-8.jsx
<button
sx={{
color: 'white',
bg: 'primary',
m: 10,
px: 4,
py: 2,
fontSize: 2,
boxShadow: 'large',
}}
@HerbCaudill
HerbCaudill / optimalBloomFilter
Created November 18, 2020 13:38
Self-optimizing Bloom filter
import { BloomFilter } from 'bloomfilter' // https://github.com/jasondavies/bloomfilter.js
/**
* Returns an optimally configured Bloom filter for the given number of elements, using the
* calculations from https://www.di-mgt.com.au/bloom-filter.html .
* @param n The number of elements to be added to the Bloom filter
* @param p The target false positive rate
*/
const optimalBloomFilter = (n: number, p: number = 0.01) => {
const LOG2 = Math.log(2)
@HerbCaudill
HerbCaudill / rename.bat
Last active May 20, 2021 10:25
rename master to main
git branch -m master main
git push -u origin main
git push origin --delete master
@REM will probably get an error on the last line
@REM go to https://github.com/XXXXX/XXXXX/settings/branches and change default branch
@REM then retry the last line
@HerbCaudill
HerbCaudill / automerge-repo-readme.md
Last active May 1, 2022 09:21
draft readme for automerge repo

Automerge repository API

A replicated key-value store that magically synchronizes with peers in the background.

Why

Automerge is a CRDT that ...

The original Automerge API leaves a number of difficult problems to be solved in userland: Storage, network communication, and synchronization are all left as an exercise for the developer.