Skip to content

Instantly share code, notes, and snippets.

@reissbaker
reissbaker / selectKeys.js
Created January 12, 2012 19:04
key selection, remapping
var selectKeys = function(hash, keys) {
var output, prop, index;
output = {};
if(!keys) return {};
if(keys instanceof Array) {
for(index = 0; index < keys.length; index++) {
output[keys[index]] = hash[keys[index]];
}
return output;
@reissbaker
reissbaker / grove-ui.js
Created April 11, 2012 06:11
Grove UI improvements
!function($, App) {
var initialized = false;
var updateUI = function() {
var $pic, $picLI, index, $prevLI, $prevPic,
$picSeparator, $picContent,
$pics = $('.userpic img' + (!initialized ? '' : ':visible')),
SPACING = '3px';
initialized = true;
@reissbaker
reissbaker / README.md
Created April 12, 2012 05:27 — forked from clizzin/README.md
Grove UI improvements

Make the Grove web client look like this

Sweet UI

  • Only show the user name and avatar for the first message in a group of messages by that user.
  • Indent the messages so they all start at the same spot.
  • Use Shift-Up and Shift-Down to switch between channels.

Made by reissbaker, h4rry, clizzin, ssorallen, and spikebrehm.

@reissbaker
reissbaker / and_then.rs
Created December 23, 2014 05:11
match vs and_then
io_result.and_then(|result| {
// do something
}).ok();
@reissbaker
reissbaker / reversing.ts
Last active April 12, 2017 04:50
typescript port of aphyr's "reversing the technical interview." compiled with --noImplicitAny and --strictNullChecks, obv.
type empty = undefined | null;
type Maybe<T> = T | empty;
type TrueCell<T> = (b: true) => T;
type FalseCell<T> = (b: false) => Maybe<TrueCell<T> | FalseCell<T>>;
type Cell<T> = TrueCell<T> | FalseCell<T>;
type Next<T> = Maybe<Cell<T>>;
type Iteration<T> = T | Next<T>;
/*
* Get the value of a Cell
@reissbaker
reissbaker / cat the young vortex dragon
Last active July 22, 2017 08:08
open pathfinder data preview
> cat ./data/output/Young\ Vortex\ Dragon.json
{
"name": "Young Vortex Dragon",
"cr": 10,
"xp": 9600,
"hp": 104,
"hd": 11,
"classes": [],
"race": "",
@reissbaker
reissbaker / output.txt
Last active August 8, 2017 04:09
terminal in a terminal
> ruby ./pty-reopen.rb 20
┌───────────────────┤ PTY SCREEN 55x20 ├───────────────────┐
│ > echo 'echoed' │
│ echoed │
│ │
│ let's run some shit in an inner pty and do some crazy f │
│ ormatting. we will run: │
│ > cat ./ruby-fd-debug.rb │
│ running... │

Window Controls

  • ⌘ ← 0x02 0x70
  • ⌘ → 0x02 0x6E

Pane Controls

  • ⌘ ⌥ ↑ 0x02 0x1B 0x5B 0x41
@reissbaker
reissbaker / glhf-chat.ts
Last active July 31, 2024 09:03
Test GLHF API
import "dotenv/config";
import { read } from "read";
import OpenAI from "openai";
import { Command } from "@commander-js/extra-typings";
const program = new Command()
.argument("<model-repo>")
.action(async (repo) => {
const baseURL = "https://glhf.chat/api/openai/v1";
const apiKey = process.env.GLHF_API_KEY;