Skip to content

Instantly share code, notes, and snippets.

View mooreryan's full-sized avatar

Ryan Moore mooreryan

View GitHub Profile
@mooreryan
mooreryan / Option.bs.js
Created October 20, 2022 20:20
Option.bs.js
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var Belt_Option = require("rescript/lib/js/belt_Option.js");
function foo(t) {
if (t !== undefined) {
console.log(t);
return t;
} else {
@mooreryan
mooreryan / bench_equal.ml
Last active September 15, 2022 01:33
OCaml equal benchmark with variants
[@@@warning "-37"]
open! Core
open! Core_bench
module Nucleotide = struct
type t = A | C | G | T
let poly_equal = Poly.( = )
@mooreryan
mooreryan / dune
Last active April 29, 2022 23:50
Export OCaml to JavaScript
(executable
(name hello)
(libraries js_of_ocaml)
(modes js)
(preprocess
(pps js_of_ocaml-ppx)))
@mooreryan
mooreryan / bench.ml
Created February 17, 2022 18:06
Benchmarking OCaml string splitting
open! Core
open! Core_bench
let s = "apple pie\tis really\tquite\ttasty and nice"
(* Like Core.String.split, but specialized for splitting on [char]. *)
let split str ~on =
let len = String.length str in
let rec loop acc last_pos pos =
if pos = -1 then String.sub str ~pos:0 ~len:last_pos :: acc
@mooreryan
mooreryan / download_sra_reads
Last active November 29, 2021 18:01
Download reads from the SRA
#!/bin/bash
if [[ $# -ne 3 ]]; then
>&2 echo "usage: download_sra_reads <acc_list.txt> <outdir> <num_threads>"
exit 1
fi
NUM_THREADS="${3}"
OUTDIR="${2}"
ACC_LIST="${1}"
@mooreryan
mooreryan / iris_pca_feature_loadings.json
Last active November 25, 2020 09:02
PCA of Edgar Anderson's Iris Data
[
{
"Feature": "PetalLength",
"PC1Loadings": 1.7615,
"PC2Loadings": 0.0854,
"PC3Loadings": -0.0213,
"PC4Loadings": -0.0741,
"PC1Axes": 0.8567,
"PC2Axes": 0.1734,
"PC3Axes": -0.0762,
@mooreryan
mooreryan / iris.json
Last active November 24, 2020 02:00
Edgar Anderson's Iris Data, with correlation and covariance
[
{
"SepalLength": 5.1,
"SepalWidth": 3.5,
"PetalLength": 1.4,
"PetalWidth": 0.2,
"Species": "setosa",
"SepalLengthScaled": -0.8977,
"SepalWidthScaled": 1.0156,
"PetalLengthScaled": -1.3358,
Sample Group Longitude Latitude Salinity DO Temperature Nitrate Ammonia Phosphate DON
GW-1 Subsurface -87.88392 30.4314 0 0.3 21.1 155.9 0.8 0.1 83
TS-SE-A Subsurface -87.87815 30.39243 0 0.1 29.3 0.7 125.2 0.1 98
TS-SE-B1 Subsurface -87.87825 30.39229 0 0.6 29.9 81.9 54.5 0.6 33
TS-SE-B2 Subsurface -87.87825 30.39229 1.8 0.6 29.4 63.9 4.5 2.7 32
TS-SE-B3 Subsurface -87.87825 30.39229 1.8 0 29.4 3.3 119.3 2.3 57
TS-SE-B4 Subsurface -87.87825 30.39229 1.8 0 29.4 2.8 92 1.8 60
TS-SE-B5 Subsurface -87.87825 30.39229 1.8 0 29.4 2.3 51.8 0.6 92
TS-NE-A1 Subsurface -87.90843 30.53017 0.1 1.3 25.5 78 0.5 0.2 10
TS-NE-A2 Subsurface -87.90843 30.53017 0.1 1.4 25.5 145 3.9 0.5 4
(ns cljs_reagent_proj.core
(:require
[reagent.core :as r]
[cljsjs.react-vis :as rvis]))
(def chart-data [{:x 1 :y 1}
{:x 2 :y 2}
{:x 3 :y 4}
{:x 4 :y 5}
{:x 5 :y 4}
(ns cljs_reagent_proj.core
(:require
[reagent.core :as r]
[cljsjs.react-vis :as rvis]))
(def chart-data [{:x 1 :y 1}
{:x 2 :y 2}
{:x 3 :y 4}
{:x 4 :y 5}
{:x 5 :y 4}