This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (set! *warn-on-reflection* true) | |
| (ns net.alwinfy.wikirace | |
| (:require | |
| [clojure.set :as set] | |
| [clojure.string :as str])) | |
| (import java.util.Scanner) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Parser { | |
| static fact(n) { | |
| return n > 0 ? n * Parser.fact(n - 1n) : 1n; | |
| } | |
| static npow(b, e) { | |
| if (e < 0) return 0n; | |
| let res = 1n; | |
| while (e) { | |
| if (e & 1n) | |
| res *= b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (set! *warn-on-reflection* true) | |
| (ns net.alwinfy.numparse) | |
| ; cljs hacks i cry | |
| #?(:cljs (def num identity)) | |
| (def char->int #?(:clj int, :cljs #(.charCodeAt %))) | |
| ; Utilities | |
| (defn lstrip [string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| // TODO: Figure out how to get recursion to actually work | |
| let RECURSION_DEPTH = 20, | |
| TIME_LIMIT = 20000; | |
| class CompileError extends SyntaxError { | |
| constructor(string) { | |
| super(string); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.here.mixin; // TODO fill this in properly | |
| import net.minecraft.block.BlockState; | |
| import net.minecraft.block.PistonBlockStructureHelper; | |
| import net.minecraft.util.Direction; | |
| import net.minecraft.util.math.BlockPos; | |
| import net.minecraft.world.World; | |
| import org.spongepowered.asm.mixin.Mixin; | |
| import org.spongepowered.asm.mixin.gen.Invoker; |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name = "jungle/path-01-entrance" | |
| mapWidth = 70 | |
| mapHeight = 120 | |
| masterLevel = 1 | |
| [[levels]] | |
| height = -16 | |
| [[levels]] | |
| height = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; Squished with the following vimscript command: | |
| ; %s/;.*//g | %s/\n/ /g | %s/\s\+/ /g | %s/\s*\([][()]\)\s*/\1/g | %s/notes-per-min/nm/g | %s/to-bytes/b/g | %s/sample-rate/sr/g | %s/bytes-per-sample/bps/g | %s/write-wav/ww/g | %s/note-freqs/nf/g | %s/note-lengt | |
| h/nl/g | %s/note/n/g | |
| (require racket/flonum) | |
| (define sample-rate 8000) | |
| (define bytes-per-sample 1) ; 8bit audio | |
| (define (to-bytes num len) | |
| (list->bytes | |
| (let loop ([num num] [len len]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::HashMap; | |
| pub struct Scope<K, V> { | |
| // Implementation note: | |
| // Since HashMaps are presumably expensive to init, | |
| // we count empty scopes pushed above a given scope | |
| // until we actually attempt to add something. | |
| bindings: Vec<(HashMap<K, V>, usize)>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![recursion_limit="256"] | |
| // If anyone here wants to go fix rust-lang/rust#38078, that would be just FINE by me | |
| use std::marker::PhantomData; | |
| struct Nil; | |
| struct Cons<H, T> { h: H, t: T } | |
| trait First { type First; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Day04 (process) where | |
| import Data.List (transpose, inits) | |
| type Board = [[Integer]] | |
| type State = [Integer] | |
| split :: (a -> Bool) -> [a] -> [[a]] | |
| split _ [] = [] | |
| split d s = x : split d (drop 1 y) where (x, y) = break d s |