Skip to content

Instantly share code, notes, and snippets.

@tgrecojs
tgrecojs / UniV3SwapAnalytics.js
Last active August 31, 2021 18:58
JS code for calculating price impact of ETH/USDC swaps
import sampleData from './sampleData.js';
/**
* Uniswaph V3 Subgraph Data
*
* Result of Qu
*/
const queries = {
swaps: `{
swaps(first: 20, where: {pool:

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@tgrecojs
tgrecojs / drive_sync_settings.sh
Created December 13, 2020 05:46
bash script for excluding
#!/usr/bin/env bash
set -e # always immediately exit upon error
# directory config. ending slashes are important!
# src_dir="$HOME/Projects/"
gdrive_projects-dir="$HOME/Google\ Drive/cloud-based-demo-applications"
# run the sync
rsync -ar --delete \
const Day = ({ get, left, right }) => {
const map = f => Day ({
get: f (extract()),
left, right
})
const extend = f =>
Day ({
get: (left, right) => f (Day ({ get, left, right })),
const Maybe = {
Just: value => ({
value,
map: f => Just(f(value)),
toString: () => `Just(${value})`
}),
Nothing: (value = null) => ({
value: null,
map: f => Nothing(null),
toString: () => `Nothing(${value})`
import curry from 'crocks/helpers/curry'
import or from 'crocks/logic/or'
import pathSatisfies from 'crocks/predicates/pathSatisfies'
import propSatisfies from 'crocks/predicates/propSatisfies'
const list = [
'nice', 'bad', 'super bad'
]
const data = [
@tgrecojs
tgrecojs / machine.js
Created December 20, 2019 03:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
{
"cols": [
"people",
"dates",
"zips",
"companies"
],
"data": [
[
"Nigel",
{
"cols": [
"people",
"dates",
"zips",
"companies"
],
"data": [
[
"Nigel",
# Exhibit A: long form way of installing packages
npm install eslint-config-airbnb eslint-config-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-html eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-prettier
# Exhibit B: using brace expansion
npm install eslint-{config-{airbnb,pretter},plugin-{react-hooks,react,html,import,jsx-a11y,prettier}}