Skip to content

Instantly share code, notes, and snippets.

@justinwoo
justinwoo / observable.rs
Created February 28, 2020 10:42
How would I avoid having to manually wrap the inner observable methods each time I use this?
// this is a parameterized Observable i would like to expose concretely typed versions of
pub struct Observable<A> {
pub state: A,
observers: Vec<js_sys::Function>,
}
// these are the methods I'd like to expose out of here
// i would especially like to expose new, subscribe, unsubscribe
impl<A: Serialize> Observable<A> {
pub fn new(state: A) -> Self {
world
(Parens
(App (Select (Identifier "pkgs") (AttrPath "fetchFromGitHub"))
(AttrSet
[ (Bind (AttrPath "owner") (StringValue "\"justinwoo\""))
, (Bind (AttrPath "repo") (StringValue "\"psc-package2nix\""))
, (Bind (AttrPath "rev") (StringValue "\"b4d6a834ac124440a503f0510b8a9de95532b16c\""))
, (Bind (AttrPath "sha256") (StringValue "\"0g9fq4j472bcr1x5na6mzr3av95xhvdmnlns1ncvsl4kqa8ix2zr\""))
])))
data Expr
@justinwoo
justinwoo / run.bash
Created May 14, 2019 17:23
maybe nobody else should do this
#!/usr/bin/env bash
while true
do
if pgrep trashsadf;
then
date
echo "we are still running"
else
@justinwoo
justinwoo / run.bash
Created May 14, 2019 17:23
maybe nobody else should do this
#!/usr/bin/env bash
while true
do
if pgrep trashsadf;
then
@justinwoo
justinwoo / script.js
Last active March 1, 2019 22:03
Make Discord easier to read
d=document,b=d.body,a=Array.from,s=d.createElement("style"),s.innerText="."+a(d.querySelectorAll("div")).flatMap(c=>a(c.classList)).find(c=>c.includes("markup"))+"{color:#111111!important}",b.append(s),b.style.fontFamily="Noto Sans CJK JP";
@justinwoo
justinwoo / test-fetch-url
Created February 16, 2019 16:41
test-fetch-url
test-fetch-url
@justinwoo
justinwoo / always-fails.nix
Last active December 23, 2018 11:47
this derivation always fails for me with nix-build
let
pkgs = import <nixpkgs> {};
name = "psc-package2nix-prefetch-${dep}-${version}";
dep = "simple-json";
repo = "https://github.com/justinwoo/purescript-simple-json.git";
version = "v4.0.0";
in pkgs.runCommand name {
buildInputs = with pkgs; [
@justinwoo
justinwoo / README.md
Created December 3, 2018 19:33 — forked from peti/README.md
Make NixOS provide version-specific LOCALE_ARCHIVE environment variables

This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE environment variables to mitigate the effects of NixOS/nixpkgs#38991.

To deploy it, copy the file into your /etc/nixos folder using a file name like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to contain the attribute:

imports = [ ./multi-glibc-locale-paths.nix ];
@justinwoo
justinwoo / default.nix
Created October 16, 2018 10:03
using noto sans in slides for beamer with pandoc in nix
let
pkgs = import <nixpkgs> {};
texlive = pkgs.texlive.combine {
inherit (pkgs.texlive)
scheme-small
collection-fontutils
collection-fontsrecommended
collection-fontsextra
fontaxes