Skip to content

Instantly share code, notes, and snippets.

View search-tree?.clj
(do (defn search-tree?* [tree]
(if (coll? tree)
(let [[root-node left-node right-node] (concat tree (cycle [nil]))]
(fn [] (and (->> [left-node root-node right-node]
(map #(if (coll? %) (first %) %))
(filter identity)
(apply <))
(search-tree?* left-node)
(search-tree?* right-node))))
true))
View core.cljs
(ns adamdavislee.c964.core
(:require [rum.core :as rum]
[garden.core :refer [css]]
[clojure.string :as str]
[clojure.edn :refer [read-string]]))
(enable-console-print!)
(defonce ratom (atom {}))
@adamdavislee
adamdavislee / configuration.nix
Last active Aug 5, 2021
My personal NixOs config. Running on a 2015 Chromebook Pixel LS (Samus). Notice that the kernel needs to be downgraded for the touchpad to be recognized.
View configuration.nix
{ config, pkgs, ... }:
{
system.stateVersion = "21.05"; # don't modify this if system is updated
imports = [ ./hardware-configuration.nix ]; # some sort of auto-generated fstabby thing :-)
boot.kernelPackages = pkgs.linuxPackages_5_4; # Most recent supported kernel that still has working touch and sound.
boot.loader.systemd-boot.enable = true; # use the systemd EFI boot loader
boot.loader.efi.canTouchEfiVariables = true; # set automatically during install
networking.hostName = "ecdicius"; # define your hostname
networking.wireless.enable = true; # enables wireless support via wpa_supplicant
View c768-2-proposal.tex
\documentclass[man, biblatex]{apa7}
\usepackage{hyperref}
\hypersetup{pdfborderstyle={/S/U/W 1},
linktocpage}
\DeclareLanguageMapping{american}{american-apa}
\usepackage{csquotes}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{soul}
\usepackage{setspace}
@adamdavislee
adamdavislee / number-theory.clj
Last active Oct 5, 2018
Translation of the Number Theory Namespace of Racket's Math Library: https://docs.racket-lang.org/math/number-theory.html
View number-theory.clj
(ns adamdavislee.math.number-theory
"This port closely mimics the naming conventions and coding style of the racket source code.
However it does not:
Define inline versions of mod+, mod*, etcetera.
TODO:
Add pre/post conditions and assertions with type checking etc.
Improve docstrings.
Finish marking internal functions as private.
Use internal memoization for some of the functions which racket uses manual bit manipulation for."
(:require [clojure.test
View roman-numeral.clj
(with-test
(defn roman-numeral
[input]
(loop [input input, acc 0, ]
(if (empty? input)
acc
(let [convert {"I" 1, "V" 5, "X" 10, "L" 50, "C" 100, "D" 500, "M" 1000, }
curr-num (convert (subs input 0 1))
op (if (and (not= 1 (count input))
(< curr-num
View index.html
<canvas></canvas>
View main.clj
(ns adamdavislee.mpd.main
(:require [neko.activity
:refer [defactivity set-content-view!]]
[neko.debug :refer [*a]]
[neko.notify
:refer [toast fire notification]]
[neko.resource :as res]
[neko.context
:refer [get-service]]
[neko.threading :refer [on-ui]]
View dump-1481063240121.cljs
cljs.user=> (def foo (atom 2))
#'cljs.user/foo
cljs.user=> 1
1
View dump-1481063220600.cljs
cljs.user=> (def foo (atom 2))
#'cljs.user/foo