Skip to content

Instantly share code, notes, and snippets.

View gnzlbg's full-sized avatar

gnzlbg gnzlbg

View GitHub Profile
@gnzlbg
gnzlbg / gist:5547905
Created May 9, 2013 14:45
variadic zip and join function extensions to boost range
#include <iostream>
#include <array>
#include <vector>
#include <list>
#include <deque>
#include "tupleit.hh" // http://pastebin.com/LFkTHdQk
#include <stdio.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@MHeasell
MHeasell / bins.js
Created April 8, 2015 22:15
My CodeCombat Zero Sum tournament entry source code. Check out https://gist.github.com/MHeasell/bb9f7253da45b5140a83 for the compiled version and http://michaelheasell.com/blog/2015/04/08/zero-sum-my-winning-strategy/ for a full write-up about my strategy.
// bin stuff -------------------------------------------------------------------
const BIN_WIDTH = 13.333333333333;
const HALF_BIN_WIDTH = (BIN_WIDTH / 2);
const BIN_HEIGHT = 14;
const HALF_BIN_HEIGHT = (BIN_HEIGHT / 2);
const NUM_BINS_X = 6;
const NUM_BINS_Y = 5;