Skip to content

Instantly share code, notes, and snippets.

Kris Selden krisselden

Block or report user

Report or block krisselden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tag.ts
// requires strict mode
// set false to minimize out runtime checks
const DEBUG = true;
export const enum TagTypes {
// C
/* adding this will cause Tag and unreachable to Error
View monomorphic_wrapper.js
// Monomorphic wrapper for polymorphic value
wrapper = {
// CheckMap wrapper for .type lookup monomorphic
if (wrapper.type === 1) {
// CheckMap value for .somefield lookup monomorphic because in branch for one type
View ustat_exact.js
// Copyright 2019 Kris Selden BSD 2-CLAUSE LICENSE
// math used is public domain just dont copy my code without giving credit.
// @ts-check
* @typedef {{get(U: number, n1: number, n2: number): number; set(U: number, n1: number, n2: number, count: number): void;}} ICache
View shifted_log_logistic.R
x <- c(...) # samples
# for fitdist
# for llog3 and lnorm3
print_ks_test <- function (x, dist, args) {
print( (...) {
ks.test(x, paste0("p", dist), ...)
View hodges_lehmann_location_shift_estimate.R
hodges_lehmann_location_shift_estimate <- function (x, y, conf.level) {
nx <- length(x)
ny <- length(y)
alpha <- 1 - conf.level
# qnorm in R is the
# this is also using the
Ca <- floor(nx * ny / 2 - qnorm(1 - alpha / 2) * sqrt(nx * ny * (nx + ny + 1) / 12))
m <- nx * ny
U <- vector(mode = "numeric", length = m)
View node_event_stream.js
const { EventEmitter } = require("events");
// Imagine your reading a stream of events from a socket
// and a data chunk event contains more than one event
// how do you adapt that one event to multiple events
// in a way that will prevent race conditions in async/await
// code?
// For example say you are waiting for a frame loaded event, then waiting
// loaded event of a child of that frame conditionally based on the
extern crate hyper;
extern crate tls_api;
extern crate tls_api_openssl;
extern crate tokio_tls_api;
use futures::{Future, Stream};
use hyper::server::conn::{AddrIncoming, Http};
use hyper::service::service_fn_ok;
use hyper::{Body, Request, Response};
use tls_api::TlsAcceptorBuilder;
use tokio_tls_api::accept_async;
View build.js
#!/usr/bin/env node
const path = require('path');
const child_process = require('child_process');
async function main() {
await yarnRun(
krisselden / blog-post-at-lookup.hbs
Last active Mar 29, 2019 — forked from raycohen/
`@` as means argument to the template not property
View blog-post-at-lookup.hbs
<div class="blog-post">
<Avatar class="blog-post__avatar" @user={{@user}} />
krisselden /
Last active Mar 26, 2019
merge repo into monorepo at prefix with history
#!/usr/bin/env bash
prefix=packages/$remote_name/ # trailing slash is important
git remote add $remote_name $remote_url
git fetch $remote_name
# create a merge commit with our side winning as the strategy but stop before committing it
git merge -s ours --allow-unrelated-histories --no-commit $remote_name/$remote_branch
You can’t perform that action at this time.