Skip to content

Instantly share code, notes, and snippets.

View jdmarshall's full-sized avatar
💭
Exploring Elixir

Jason Marshall jdmarshall

💭
Exploring Elixir
View GitHub Profile
@jdmarshall
jdmarshall / hrtime.js
Last active March 10, 2025 00:06
Clock jitter in hrtime.bigInt()
function bench() {
let samples = [];
let start = process.hrtime.bigint();
for (let i = 0; i < 100_000_000; i++) {
let s = process.hrtime.bigint();
let foo = JSON.parse('{ "a": 1, "b": 2, "c": 3, "d": 4 }');
samples.push(process.hrtime.bigint() - s);
@jdmarshall
jdmarshall / gist:563c8612ce3c78ff612ace30bd0c5cf7
Created February 23, 2025 19:27
Example working with mdex
def markdown(assigns) do
body =
case (assigns.value) do
nil -> assigns.fallback
_ -> anchors_with_targets(assigns.value)
end
~H"""
<div class={["markdown", @class]}>
<%= body %>
#! /usr/bin/env node
var domain = require('domain');
var Promise = require('bluebird');
console.log('This is a demonstration of a bug in Bluebird when Domains are involved.');
console.log('If a then() throws an exception, the domain does not exit() and remains on the stack.');
function reportDomainDepth(state) {
console.log(state + ', current domain depth is ' + domain._stack.length);