Skip to content

Instantly share code, notes, and snippets.

@vorce
vorce / gist:8718599
Created Jan 30, 2014
Compojure example
View gist:8718599
(ns webpoints.handler
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]))
;; Our "database"
(def mydb (atom {}))
(defn set-points
"Update hostname with points"
@vorce
vorce / gist:5817721
Created Jun 19, 2013
Spazmo-qore, contribution to the 4k source compo 2004
View gist:5817721
#include "g.h"
#define f float
f P=3.1415,X= 500,Y=400, o;
#define e glEnd
#define g glVertex3d
#define n glEnable
#define N glNormal3d
#define fl for(
#define i int
c(f h) { f j; glBegin(6); N(0,0,-1);g(0,0,0);
View gist:5748534
(defn hex-to-rgb
"Convert hex strings to rgb list. Ex: 'FF0000' -> (255 0 0)"
[hex]
(let [ hex-pairs (partition 2 hex) ]
(for [p hex-pairs]
(java.lang.Integer/parseInt (apply str p) 16))))
@vorce
vorce / gist:5373385
Created Apr 12, 2013
SHahara. Shell script sandbox for VirtualBox. Basically just a wrapper for VBoxManage snapshot.
View gist:5373385
#!/bin/sh
# SHahara
# Inspired by: https://github.com/jedi4ever/sahara
#
# Sandbox for virtualbox for shell scripts
# Wrapper for VBoxManage and snapshots
SH_TEST_SNAPSHOT=sh_test_snapshot
VBOX=VBoxManage
@vorce
vorce / gist:5227527
Last active Dec 15, 2015
Roman numerals kata in Elixir lang. My very first use of the language >_<
View gist:5227527
Code.require_file "../test_helper.exs", __FILE__
defmodule ElixirRoman1Test do
@moduledoc "Tests number to roman numerals"
use ExUnit.Case
defp romans_list do
HashDict.new [ {10, "X"}, {9, "IX"}, {5, "V"},
{4, "IV"}, {1, "I"}]
@vorce
vorce / Elixir ExUNit error message
Created Mar 23, 2013
Test case failure from Elixir's ExUnit
View Elixir ExUNit error message
% elixir test/elixir_roman1_test.exs
1) test roman 1 should return I (ElixirRoman1Test)
** (ExUnit.ExpectationError)
expected: "I"
to be equal to (==): ""
at /home/vorce/code/elixir_roman1/test/elixir_roman1_test.exs:19
3 tests, 1 failures.
You can’t perform that action at this time.