Skip to content

Instantly share code, notes, and snippets.

@quaat
quaat / argparser.h
Created July 5, 2013 12:16
An argument parser for use with Qt. The parser itself stores the keywords as properties in QCoreApplication.
#ifndef ARG_PARSER_H_DEF
#define ARG_PARSER_H_DEF
#include <QCoreApplication>
#include <QString>
#include <QStringList>
// some unique keyword.
char static const *restkeyword = "unique-9c6e6236e14a43";
(ns offset.core
(:use (incanter core stats charts datasets))
(:use [clojure.math.combinatorics])
(:require [clojure.string :as cstr]
[clojure.data.csv :as csv]
[clojure.java.io :as io]))
(defn- to-dec [t]
(if (= 1 (count t))
(first t)
#include <iostream>
#include <vector>
#include <memory>
template <typename T, unsigned d1, unsigned d2 = 1, unsigned d3 = 1, unsigned d4 = 1>
struct TensorType
{
typedef typename T real;
static unsigned const rank = (d1 > 1 ? ( d2 > 1 ? (d3 > 1 ? (d4 > 1 ? 4 : 3) : 2) : 1) : 0);
@quaat
quaat / gist:4978425
Last active December 13, 2015 21:38
zip for javscript
// Examples inspired by http://learnyouahaskell.com/syntax-in-functions
var fibobj = {
0: function(){return 1},
1: function(){return 1},
undefined: function(n){return fibs(n-1) + fibs(n-2)}
}
var fibs = (function(o){