Skip to content

Instantly share code, notes, and snippets.

View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View trace-query.sh
jq '.traceEvents | map(select(.cat | split(",") | map(. == "devtools.timeline") | any)) | unique_by(.name) | map(.name)'
jq ".traceEvents | map(select(.ts == 0)) | map(.ph) | unique"
View components.select-list\.js
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
class Cell {
@tracked value;
constructor(key, value) {
this.key = key;
this.value = value;
}
View v8 stable sort in node.txt
V8 v7.0 and Chrome 70
node stable sort / timsort
build
55360
7.0.257
node v11.0.0
7.0.276.28-node.5
node v11.15.0
View resilient-queue.js
function createQueue() {
let queue = [];
let i = 0;
let len = 0;
return [
(fn) => (queue[len++] = fn),
() => {
try {
for (; i < len; i++) {
const fn = queue[i];
@krisselden
krisselden / require-or-import-test-proxy.js
Last active Jun 12, 2020
Test helper to test both require or import conditional export.
View require-or-import-test-proxy.js
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/*
This helper module allows us to import from the module under test
while using the package conditional exports of "import" if supported
or falling back to package "main" if not supported.
Which lets us run the same test suite on both exports to ensure that
it works on Node < 12.17.0 or newer node using require or import.
View llogis.r
#!/usr/bin/env Rscript
# real load samples
a <- c(1075, 1043, 964, 965, 1067, 1111, 929, 1016, 983, 998, 995, 994, 995, 1064, 1025, 1078, 987, 998, 992, 1094, 965, 993, 1022, 964, 1002, 926, 1408, 1083, 944, 988, 960, 979, 939, 936, 990, 947, 1037, 1034, 1057, 1095, 1015, 941, 1054, 1050, 1192, 973, 1321, 1051, 974, 906)
b <- c(1023, 1175, 1230, 1055, 1073, 1118, 1030, 1093, 1095, 1040, 1166, 1257, 1151, 1047, 1217, 1247, 1256, 1057, 1152, 1074, 1016, 1040, 1176, 1135, 1003, 1178, 1136, 1402, 1215, 1176, 1107, 1202, 1080, 1068, 1133, 1091, 1041, 1143, 1140, 1156, 1062, 1076, 973, 1048, 1183, 1165, 1246, 1225, 1174, 1063)
# the 3 param log-logistic is a good distribution for simulating typical
# performance samples from page load
dllogis <- function(x, location = 0, scale = 1, shape = 2) {
((shape / scale) * (((x - location) / scale)^(shape - 1))) / (
View better-glimmer-debugging.md

Pass in an invocables array of c => c() that is source mapped to mustache/Component/s-exp locations during template compile.

Now anytime the VM executes something that invokes user land code that might fail it can do it with the slotted invocable wrapper in both Append mode or Update mode and with the sourcemap this will place the hbs file on the stack and allow you to set a breakpoint in the mustache, Component or subexpression.

Also, possibly make bindings thunks so they can be debugged when the VM reads them, so if they were an unexpected value you'd be able to see.

View request_streaming_samples.r
library(tidyverse)
# sample, treatment, chunk size, timestamp
chunks <- read.csv("results.csv")
sorted_and_summed <- chunks %>%
group_by(sample) %>%
arrange(timestamp, .by_group = T) %>%
mutate(
bytes_received = cumsum(bytes),
View test_stream.js
const tls = require("tls");
const https = require("https");
const { pipeline, Writable } = require("stream");
const zlib = require("zlib");
const { StringDecoder } = require("string_decoder");
/**
* @typedef {Object} Config
* @property {string} url
* @property {string} sessionCookie
You can’t perform that action at this time.