Skip to content

Instantly share code, notes, and snippets.

View brendanzab's full-sized avatar
😵‍💫
writing elaborators

Brendan Zabarauskas brendanzab

😵‍💫
writing elaborators
View GitHub Profile
digraph widening {
node [style=filled, colorscheme=pastel13, color=2] "i8"; "i16"; "i32"; "i64";
node [style=filled, colorscheme=pastel13, color=3] "u8"; "u16"; "u32"; "u64";
"i8" -> "i16"
"i8" -> "i32"
"i8" -> "i64"
"i16" -> "i32"
"i16" -> "i64"
"i32" -> "i64"
#![feature(slice_patterns)]
use std::fmt;
use std::ops;
#[derive(Clone, Debug)]
pub enum Doc<'a> {
Text(&'a str, Vec<Doc<'a>>),
Line(usize, Vec<Doc<'a>>),
}
import History
import Graphics.Element exposing (Element, show)
import Mouse
import Signal exposing ((<~))
type alias Model = Int
init : Model
init = 0
import History
import Graphics.Element exposing (Element, show)
import Mouse
import Signal exposing ((<~))
import Task exposing (Task)
makeTitle : Int -> String
makeTitle n = "n = " ++ toString n
port title : Signal String
import Graphics.Element exposing (Element, show)
import Mouse
type alias Model =
{ n : Int
}
init : Model

Generalized Balanced Ternary (GBT)

            ,+,     ,+,
         +'  5₈ '+'  1₈ '+
         |  101₂ |  001₂ |
        ,+,     ,+,     ,+,
     +'  4₈ '+'  0₈ '+'  3₈ '+
     |  100₂ |  000₂ |  011₂ |
 +, ,+, ,+, ,+
@brendanzab
brendanzab / swizzle_gen.rs
Last active September 27, 2015 04:41 — forked from anonymous/playground.rs
Shared via Rust Playground
fn main() {
swizzle_gen();
}
fn swizzle_gen() {
swizzle_gen0("x");
swizzle_gen0("y");
swizzle_gen0("z");
swizzle_gen0("w");
}
#include <stdlib.h>
#include <stdio.h>
#include <GL/glfw3.h>
int main()
{
GLFWwindow window;
if( !glfwInit() )
{
import glfw3::*;
fn run(init_fn: &fn(), update_fn: &fn(tpf: f64), render_fn: &fn(), cleanup_fn: &fn()) {
init(init_fn, cleanup_fn);
mainloop(update_fn, render_fn, cleanup_fn);
cleanup(cleanup_fn);
}
fn init(init_fn: &fn(), cleanup_fn: &fn()) {
init_fn();
@brendanzab
brendanzab / glcorearb.rs
Created October 2, 2012 04:01
glcorearb
// #ifndef __glcorearb_h_
// #define __glcorearb_h_
// #ifdef __cplusplus
// extern "C" {
// #endif
/*
** Copyright (c) 2007-2012 The Khronos Group Inc.
**