This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First sketch, with just functions. | |
// Usage: | |
// Observable<Boolean> myCondition = ... | |
// Observable<List<Foo>> foos = onCondition(myCondition, | |
// fetchFoos(a1, a2, a3), // returns a Func0<Observable<List<Foo>>> | |
// { empty() }) | |
// .flatMap({it}) | |
public final static <R> Observable<R> onCondition(Observable<Boolean> observable, | |
final Func0<? extends R> onTrue, | |
final Func0<? extends R> onFalse) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Observes an {@link Observable<T>} and returns a new Observable<R> that emits | |
* items based on the predicate<T> and the <R> onTrue and <R> onFalse functions. | |
*/ | |
public class ObservableCondition<R, T> { | |
private final rx.Observable<T> condition; | |
private Func0<? extends R> onTrue = {} | |
private Func0<? extends R> onFalse = {} | |
private Predicate<T> predicate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns symmetri.core | |
(:use quil.core | |
raev.core)) | |
(def mid-x 400) | |
(def mid-y 300) | |
(defrecord Point [x y z]) | |
(defrecord Sym [s1 s2 col]) | |
(defrecord Colors [r g b a]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns vorce.procedural.simplex) | |
; Direct translation of | |
; https://github.com/mikera/clisk/blob/develop/src/main/java/clisk/noise/Simplex.java | |
; to clojure. | |
; ...... friday night fun. | |
; Only supports 2d right now. | |
(defstruct grad :x :y :z :w) |
OlderNewer