Skip to content

Instantly share code, notes, and snippets.

@evanmiller
evanmiller / DfReader.cpp
Last active Oct 8, 2015
Haven / Debug AIX
View DfReader.cpp
#include <Rcpp.h>
using namespace Rcpp;
#include "readstat.h"
#include "haven_types.h"
class LabelSet {
std::vector<std::string> labels_;
std::vector<std::string> values_s_;
std::vector<int> values_i_;
std::vector<double> values_d_;
@evanmiller
evanmiller / readstat_sas.c
Created Oct 8, 2015
ReadStat / Debug AIX
View readstat_sas.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include "readstat_sas.h"
#include "readstat_iconv.h"
#include "readstat_convert.h"
#include "readstat_io.h"
View gist:9022903
{
"metadata": {
"language": "Julia",
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
View gist:5841466
fold_down(Acc) when Acc bsr 16 > 0 ->
fold_down((Acc band 16#FFFF) + (Acc bsr 16));
fold_down(Acc) -> Acc.
View gist:5834171
defmodule CheckDigit do
import Enum
@doc """
Determine if a sequence of digits is valid, assuming the last digit is
a Luhn checksum. (http://en.wikipedia.org/wiki/Luhn_algorithm)
"""
def valid?(numbers) when is_list(numbers) do
View gist:5833698
evenodd(List) -> evenodd(List, [], []).
evenodd([Even, Odd|Rest], Evens, Odds) ->
evenodd(Rest, [Even|Evens], [Odd|Odds]);
evenodd([Even], Evens, Odds) ->
evenodd([], [Even|Evens], Odds);
evenodd([], Evens, Odds) ->
{lists:reverse(Evens), lists:reverse(Odds)}.
View gist:3157712
-module(testproj_test_controller, [Req]).
-compile(export_all).
csv('GET', []) ->
{stream, fun
(first_line) ->
{output, "var1,var2,var3\n", 0};
(100) ->
done;
(N) when is_integer(N) ->
@evanmiller
evanmiller / rr_db.erl
Created Jan 10, 2012
Scattered remains of Chicagosaurus Rex
View rr_db.erl
-module(rr_db, [Server, PhotoRoot]).
-define(MIME_TYPE, "application/json").
-compile(export_all).
init() ->
inets:start(),
inets:start(httpc, [{profile, database}]).
reset() ->