Skip to content

Instantly share code, notes, and snippets.

View brehaut's full-sized avatar

Andrew Brehaut brehaut

View GitHub Profile
@brehaut
brehaut / README.md
Last active November 3, 2024 19:45
JJ aware powershell prompt

jj Aware Powershell Prompt

This is a simple script to create a nice powershell prompt with jj version control integration.

Path names are abbreviated approximately like fish does out of the box, and $HOME is abbreviated to ~. The VCS information appears on the far right when in a jj repository.

Window/tab title is set to the working directory, or, if in a jj

@brehaut
brehaut / demo.html
Last active September 20, 2019 01:34
Sketch of newsfoot.js
<!DOCTYPE html>
<html lang="en">
<head>
<script async="async" src="newsfoot.js"></script>
<style>
.newsfoot-footnote-container {
position: relative;
display: inline;
}
@brehaut
brehaut / LICENSE
Last active October 6, 2018 07:23
Types and a couple of utility functions for generating JSONfeeds from node.js and TypeScript
Copyright (c) 2018, Andrew Brehaut
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
@brehaut
brehaut / removeelement.js
Last active March 1, 2017 22:39
A bookmarklet to remove the next element clicked
Copy the text on line 3 and paste it as the location of a new bookmark in your browser.
javascript:void (function%20()%20%7B%20%20%20%20%20function%20handler(ev)%20%7B%20%20%20%20%20%20%20%20%20document.body.removeEventListener(%22click%22,%20handler);%20%20%20%20%20%20%20%20%20%20ev.target.parentElement.removeChild(ev.target);%20%20%20%20%20%20%20%20%20ev.preventDefault();%20%20%20%20%20%20%20%20%20ev.stopPropagation();%20%20%20%20%20%7D%20%20%20%20%20%20document.body.addEventListener(%22click%22,%20handler);%20%7D)();
@brehaut
brehaut / valuemap.ts
Last active October 14, 2016 02:55
A primative Map class that accepts value-like objects as keys
type Hashcode = number;
interface IHashable {
hashcode(): Hashcode;
equals(o: IHashable): boolean;
}
type Association<K extends IHashable, V> = [K, V];
@brehaut
brehaut / message-interface.ts
Last active May 20, 2016 06:08
Toy example of a messages interface for typescript
interface IMessage<TKey extends string, TPayload> {
key: TKey;
payload: TPayload;
}
type GenericMessage = IMessage<string, any>;
module foo {
type FooBarKeyT = "foo.bar";
const FooBarKey: FooBarKeyT = "foo.bar";
@brehaut
brehaut / NOTE
Created April 24, 2015 03:41
A skeleton PircBot wrapper in Clojure
This code is influenced by https://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot/core.clj
@brehaut
brehaut / gist:9673354
Created March 20, 2014 20:40
monster allocation via logic
;; Sorry about the horrible code. This is my first shot at a core.logic program.
;;
;; Basically this is a change calculator that returns all possible combinations of change for a given
;; total. Instead of being about money its about monsters for tabletop RPGs.
(require '[clojure.core.logic :as l]
'[clojure.core.logic.fd :as fd])
(defn allocate-monsterso [points monsters out]
"This relation finds all the allocations of monsters for the given points.
@brehaut
brehaut / LICENSE
Last active June 20, 2024 04:00
Responsive grid overlay with bookmarklet
Copyright (c) 2013 Andrew Brehaut
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@brehaut
brehaut / broken.html
Created September 17, 2013 23:21
ontransitionend with new elements
<!DOCTYPE html>
<html>
<head>
<style>
body > div {
position: relative;
height: 50px;
margin-bottom: 10px;
}