Skip to content

Instantly share code, notes, and snippets.

View newswim's full-sized avatar
🦬
Hi

Dan Minshew newswim

🦬
Hi
View GitHub Profile
@derac
derac / proxy_per_context.py
Last active February 17, 2022 16:10
per-context proxies with Playwright
import asyncio
from playwright.async_api import async_playwright
proxy_servers = [
"http://PROXY_IP1:PORT",
"http://PROXY_IP2:PORT",
]
async def spawn_context(browser, proxy_server):
@rpivo
rpivo / index.md
Last active March 18, 2024 05:03
Encrypting & Decrypting Sensitive Data With the Web Crypto API

Encrypting & Decrypting Sensitive Data With the Web Crypto API

Chris Veness created a really great gist that shares code to encrypt and decrypt data using the Web Crypto API here.

This gist breaks down the code in that gist step by step, detailing a real-world scenario with actual data.

It might be helpful to have that gist open in another tab and use this gist to walk through each line of code.

One interesting use case for this would be to encrypt on a client, and then decrypt in the cloud with something like a Lambda function. In order to do this, you could use Node's latest version as of this gist, version 15, which includes a webcrypto module that's designed to be a Node implementation of the Web Crypto API. Lambdas can't use v15 by default -- however, you can create a custom Lambda layer that contains v15.

@owickstrom
owickstrom / TodoMVC.spec.purs
Last active March 12, 2021 01:19
TodoMVC Showdown Specification
module WebCheck.PureScript.TodoMVC where
import WebCheck.DSL
import Data.Array (filter, foldMap, head, last, zip)
import Data.Foldable (length)
import Data.Int as Int
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String (Pattern(..), split, trim)
import Data.Tuple (Tuple(..))
@gcanti
gcanti / GADT.ts
Last active September 23, 2022 10:55
Approximating GADTs in TypeScript
// Adapted from http://code.slipthrough.net/2016/08/10/approximating-gadts-in-purescript/
import { Kind, URIS } from 'fp-ts/lib/HKT'
import { URI } from 'fp-ts/lib/Identity'
import { identity } from 'fp-ts/lib/function'
// ------------------------------------------
// Leibniz
// ------------------------------------------
@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active April 12, 2024 14:24
Optics Cheatsheet
@graninas
graninas / haskell_approaches_comparison_table.md
Last active April 25, 2024 20:49
Haskell Approaches Comparison Table

An Opinionated Comparison of Software Design Approaches in Haskell

| | Raw IO | Free Monads; Church Encoded Free Monads | Final Tagless / mtl | Effect Systems | ReaderT

@chexxor
chexxor / purescript-lazy-load-modules-idea.md
Last active May 3, 2022 14:39
PureScript Lazy-load Modules Idea

Lazy/Dynamic Loadable Modules in PureScript

Motivation

https://discourse.purescript.org/t/lazy-loading-routes-in-tea-style-app/141/2

Ideas

  • Here, we aren't first-class modules, because we are still using the normal module definition and import system. We believe that first-class modules refer to a special feature in OCaml.
  • Can not refer to type classes across a lazy-load boundary. Type-class instances and classes are not first-class values.
@Kazark
Kazark / NotNotLEM.idr
Last active November 13, 2018 15:17
Intuitionist logic is by no means denying the law of excluded middle!
module NotNotLEM
%default total
%access public export
notDistributesOverEither : Not (Either a b) -> (Not a, Not b)
notDistributesOverEither neither = (notLeft neither, notRight neither) where
notLeft : Not (Either a b) -> Not a
notLeft neither x = neither (Left x)
@busypeoples
busypeoples / HashTrie.js
Last active July 16, 2018 18:59
Implementing persistent data structures with HashTries
// @flow
// Immutable Data Implementation
// Based on Hash Tries
// (NOTE: The actual implementation is based on hashed mapped tries!)
// But this can be seen as a basis for the actual implementation.
// This is only for learning purposes!
// Hash Trie or Hash Tree is a persistent data structure, commonly used
// to implement immuable maps.