Skip to content

Instantly share code, notes, and snippets.

View bcomnes's full-sized avatar

Bret Comnes bcomnes

View GitHub Profile
@bcomnes
bcomnes / launch.json5
Last active March 11, 2018 18:44
How to set up vs code debugger with a run script
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-support-for-npm-and-other-tools
"version": "0.2.0",
"configurations": [
{
"name": "Launch via test NPM",
"type": "node",
@WebReflection
WebReflection / hyper-lit.md
Last active November 8, 2022 03:55
lit-html is awesome, but it came afterwards

The history of hyperHTML followed by lit-html

While many remember the epic hyperHTML: A Virtual DOM Alternative post I've published the 5th of March 2017, the first official implementation of the library was working as hyperHTML.bind(node) function for tagged literals the day before, and it's been in my experiments folder already for a little while.

The hilarious reaction from the skeptical community

At first glance people couldn't believe performance of the DBMonster demo shown in that article,

var html = require('./index')
var world = 'xyz'
var planet = [
document.createElement('strong')
]
planet[0].textContent = 'planet'
var res = html.render(Main(world, planet))
function Main (world, who) {
@vktr
vktr / rule.js
Created February 10, 2018 18:54
Add Stripe Customer Id to Auth0 via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
}
var stripe = require('stripe')('sk_....');
var customer = {
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active July 17, 2023 02:45
npm's proposal for supporting ES modules in node

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@tttimur
tttimur / image-optim.sh
Last active May 21, 2021 15:33
Image optimization with mozjpeg and webp
# this is not a bash file to execute, but run the following commands in your terminal
# requirements (install instructions at bottom of page)
# imagemin-cli, imagemin-mozjpeg, imagemin-pngquant, imagemin-webp, imagemagick (mogrify)
--------------------------------------------------------------
# 1. create the appropriate directories
$ mkdir build large large-webp small small-webp
# 2. mozjpeg compression of fullsize images
$ imagemin *.jpg --out-dir=build --plugin=mozjpeg && imagemin *.png --out-dir=build --plugin=pngquant
@cblgh
cblgh / dat-quickstart.md
Last active May 1, 2018 19:29
make the p2p web with dat's primitives

low level primitives (in ascending abstraction)

  • hypercore works with individual posts in an append-only feed
  • hyperdrive abstracted filestore / works with files
  • hyperdiscovery create p2p swarms for hypercores, hyperdrives, and hyperdbs
  • hyperdb key-value database

higher level abstractions

  • webdb database; basically a document(?) store
  • dat-node built ontop of hypercore & hyperdrive, abstracts a bunch of stuff; less complex but also less flexible
@balupton
balupton / README.md
Last active June 5, 2019 10:26
Summary of the Node.js Board controversy from what I can gather
@tj
tj / snippets.coffee
Last active September 1, 2018 19:01
Atom snippets for Go
'.source.go':
'Options':
'prefix': 'options'
'body': '''
// Option function.
type Option func(*$1)
// New with the given options.
func New(options ...Option) *$1 {
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian