Skip to content

Instantly share code, notes, and snippets.

View kgryte's full-sized avatar
😃
Working on stdlib...

Athan kgryte

😃
Working on stdlib...
View GitHub Profile
@felipap
felipap / gist:d23858fe4245e47a225891722e3441ac
Last active March 13, 2026 08:00
Joyent's Error Handling in Node.js

The links to the original on the internet are all down. Posting this here hoping others can easily find it. Of course, I don't own this content.

Error Handling in Node.js

Error handling is a pain, and it's easy to get by for a long time in Node.js without dealing with errors correctly. However, building robust Node.js applications requires dealing with errors properly, and it's not hard to learn how. If you're really impatient, skip down to the "Summary" section for a tl;dr.

This document will answer several questions that programmers new to Node.js often ask:

  • In functions that I write, when should I throw an error, and when should I emit it with a callback, event emitter, or something else?
  • What should my functions assume about their arguments? Should I check that they're the correct types? Should I check more specific constraints, like that an argument is non-null, is non-negative, looks like an IP address, or the like?

dynamic-typedarray

Introduction

This module wraps typed arrays with a minimal abstraction so that you can resize and append to them without reallocating and transferring data yourself.

Example

When initializing, you may pass an Array, a typed array, a size, or a dtype string. (Adding a dtype string will cast the data if necessary.) The following are equivalent ways to initialize a double precision dynamic typed array.

@surma
surma / README.md
Last active January 4, 2025 01:26
webpack-emscripten-wasm

Minimal example making webpack and wasm/Emscripten work together.

Build instructions:

  • Clone this gist
  • npm install
  • npm start
  • Open http://localhost:8080
  • Look at console
@yosuke-furukawa
yosuke-furukawa / nodefest_timetable.md
Last active October 18, 2017 02:15
NodeFest Timetable

Timetable

当日のタイムテーブル

11/24

Speakers's dinner 🔈

when where who what
19:30 Shibuya? Staff + Speaker + Sponsers Dinner
@mafintosh
mafintosh / npm-classic-config.sh
Last active June 21, 2018 17:40
Resets the npm defaults to how they used to be
npm config set loglevel http
npm config set progress false
npm config set package-lock false
npm config set save false
mkdir -p ~/.config/configstore/
printf '{"optOut": true,"lastUpdateCheck": 0}' > ~/.config/configstore/update-notifier-npm.json
@max-mapper
max-mapper / bibtex.png
Last active November 19, 2025 13:01
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
  • Solving tricky problems in real-world code bases and the lessons learned along the way
  • Nodebots, IoT, and hardware hacking at large
  • Real-time web applications
  • Offline-first web applications
  • Developing for small screens, big screens, or no screen at all
  • A modern take on JavaScript (or Open Web) fundamentals
  • The intersection of art and code
  • Historical insights into the modern web
  • Crazy hacks and even crazier ideas
  • Developer tools, workflows, and best practices
@cormullion
cormullion / stackad.jl
Last active January 7, 2018 11:31
Make StackOverflow ad for Julia
#!/usr/bin/env julia
using Luxor, Colors
Drawing(600, 500, "/tmp/stackad.png")
origin()
background("white")
# background textifying, not for reading, fortunately
function background_text(str_array, fontsz, beginning::Point, ending::Point)
@mafintosh
mafintosh / app.js
Last active November 26, 2022 00:03
Showcasing bundled prebuilds with different runtimes
var electron = require('electron')
electron.app.on('ready', function () {
var win = new electron.BrowserWindow({
width: 800,
height: 600
})
win.loadURL('file://' + __dirname + '/index.html')
win.toggleDevTools()
@vicapow
vicapow / example3-helloworld.s
Created December 31, 2016 21:38
'Hello world!' in x86_64 assembly without using any external libs.
## 'Hello world!' in x86_64 AT&T gas assembly in OS X.
## To assemble $> as -arch x86_64 example3-helloworld.s -o example3-helloworld.o
## To link: $> ld -arch x86_64 example3-helloworld.o -e _main -o example3-helloworld -lSystem
.section __TEXT,__text
.macosx_version_min 10, 12
.globl _main
_main:
movq $0x2000004, %rax # write (system call $4 with $0x2000000 offset)
movq $1, %rdi # write to stdout (fid 1)
leaq L_.str(%rip), %rsi # set the register address of the start of the string