Skip to content

Instantly share code, notes, and snippets.

View Havvy's full-sized avatar

Ryan Scheel Havvy

  • Work is not programming related
  • Washington, USA
View GitHub Profile
let describe = macro {
rule { $name:lit { $body ... } } => {
describe($name, function () {
$body ...
});
}
}
let it = macro {
rule { $name:lit { $body ... } } => {
On different axies.
Two concepts that are orthogonal can be used (or happen) with or without each other freely,
and do not affect each other.
For a geometric example, perpendicular lines are orthogonal.
For a general example, the metric system and the imperial system are orthogonal. While they
are not usually used together, there is nothing wrong with saying millipounds or kilofeet.
On the other hand, the imperial system and SI Units are not orthogonal. SI uses 'meters' where
fn main () {
use std::vec_ng::Vec;
let mut a_vec: Vec<int> = Vec::new();
a_vec.push(0);
a_vec.push(1);
a_vec.push(2);
let a_str: ~str;
@Havvy
Havvy / code.sjs
Last active August 29, 2015 14:08
macro commaBetweenRules {
rule { a } => { "a" },
rule { b } => { "b" }
}
var forEachDelayed = function recur (array, fn, delay, ix) {
ix = (typeof ix === "number") ? ix : 0;
fn(array[ix], ix, array);
if (ix === array.length - 1) { return; }
setTimeout(function () {
recur(array, fn, delay, ix + 1);
}, delay);
};
@Havvy
Havvy / JS-Styles.md
Last active August 29, 2015 14:13
Style Guides

Whitespace

  • I prefer projects to be four space indents, though you can convince me to use tabs if we're starting a project together.
  • Opening brackets do not belong on their own line.
  • Spaces go on both sides of operators, always.
  • Spaces never go on the inside of parenthesis except for curly braces of single line functions.
  • That said, single line function expressions/declarations should be avoided. Mostly their usecase is IRC.

Semicolons

@Havvy
Havvy / Modules.cfg
Created March 21, 2015 00:45
Iguana Tweaks Config
# Configuration file
"tinker's construct addon: iguana tweaks for tinkers construct" {
# Stuff used for debugging. You probably don't want this.
B:Debug=false
# Modify tool and item mining levels to create a tiered-ish progression
B:HarvestLevelTweaks=false
# All the Items Iguana Tweaks for TConstruct adds (Clay Buckets,...)
// Given a phone number (array of 10 digits), find all alphabetical permutations using the following digit mapping.
// Dont look up the answer, that ruins the fun!
var digitMap = {
0: ['0'],
1: ['1'],
2: ['a','b','c'],
3: ['d','e','f'],
4: ['g','h','i'],
5: ['j','k','l'],
@Havvy
Havvy / build-rust-platform.log
Created May 24, 2015 11:52
Results of building nixpkgs.rustPlatform on master branch of nixos/nixpkgs on May 23rd, 2015.
This file has been truncated, but you can view the full file.
installing ‘cargo-2015-05-13’
installing ‘rustRegistry-2015-05-19-6280837’
installing ‘rustc-1.0.0’
these derivations will be built:
/nix/store/z1l9b79d34sqjvasygr2w0jjz0whgwnb-mirrors-list.drv
/nix/store/vys3a7x9nmkx6vax2ax9c1qngqdcsxq5-rust-stage0-2015-03-27-5520801-linux-x86_64-ef2154372e97a3cb687897d027fd51c8f2c5f349.tar.bz2.drv
/nix/store/1bynbqdg4fxyhvzkxf4v8v3gsi128jrj-rust-stage0.drv
/nix/store/gxh2695ccgi3prc2i6b6yi7nzph3sgkx-stdenv-linux-boot.drv
/nix/store/zp6pjvsigb2fzyjh8vs6gm9p1phykcva-bootstrap-glibc.drv
/nix/store/jy41xsg5b1897bd23md3xfhvsg1pj7hg-bootstrap-gcc-wrapper.drv
@Havvy
Havvy / FizzBuzz.rs
Created June 15, 2015 23:51
I went with using an Iterator instead of the traditional if/else chain.
use std::fmt;
enum FizzBuzz {
Fizz,
Buzz,
}
impl fmt::Display for FizzBuzz {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {