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
XDEF schrofer | |
schrofer | |
DCB.L 32,0 onzin | |
DCB.L 32,0 spatie | |
DCB.L 32*15,0 | |
DC.L %00000000000000000000000000000000 | |
DC.L %00000000000000000000000000000000 |
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 #^{:author "Remco van 't Veer" | |
:doc | |
"Basic validation framework for maps. The constructed validator | |
functions take two arguments the before- and after state of the map. | |
They return a map of errors where keys are, typically, keys of the | |
input map and values are lists of keyworded errors or maps of keyword | |
errors to some relevant argument. For example: | |
((validator (not-blank :nr) |
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 remvee.metric.levenshtein | |
(:use [clojure.test])) | |
;; From: http://en.wikipedia.org/wiki/Levenshtein_distance | |
;; | |
;; int LevenshteinDistance(char s[1..m], char t[1..n]) | |
;; { | |
;; // for all i and j, d[i,j] will hold the Levenshtein distance between | |
;; // the first i characters of s and the first j characters of t; | |
;; // note that d has (m+1)x(n+1) values |
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 pom | |
[:use clojure.test] | |
[:import java.util.Calendar java.util.Date java.util.TimeZone]) | |
;; /* | |
;; * Phase of the Moon. Calculates the current phase of the moon. | |
;; * Based on routines from `Practical Astronomy with Your Calculator', | |
;; * by Duffett-Smith. Comments give the section from the book that | |
;; * particular piece of code was adapted from. | |
;; * |
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 roman [:use clojure.test]) | |
(def num-to-dig {1 "I", 4 "IV", 5 "V", 9 "IX" | |
10 "X", 40 "XL", 50 "L", 90 "XC" | |
100 "C", 400 "CD", 500 "D", 900 "CM" | |
1000 "M"}) | |
(def dig-to-num (into {} (map (fn [[k v]] [v k]) num-to-dig))) | |
(defn encode |
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 week-number | |
"Week number according to the ISO-8601 standard, weeks starting on | |
Monday. The first week of the year is the week that contains that | |
year's first Thursday (='First 4-day week'). The highest week number | |
in a year is either 52 or 53." | |
[ts] | |
(let [year (.getFullYear ts) | |
month (.getMonth ts) | |
date (.getDate ts) | |
day (.getDay ts) |
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 draw-image [canvas img orientation] | |
(let [ctx (.getContext canvas "2d") | |
[width height] (.-width img) (.-height img)] | |
(case orientation | |
(1 nil) ; left top | |
(do | |
(set! (.-width canvas) width) | |
(set! (.-height canvas) height) | |
(.drawImage ctx img 0 0 width height)) |
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 detect-keyboard-on-screen! | |
"Try to detect keyboard going on and off screen and toggle class on | |
the element when applicable." | |
[el class] | |
(let [former-height (atom (.-innerHeight js/window))] | |
(.addEventListener | |
js/window "resize" | |
#(let [focus (.-activeElement js/document) | |
height (.-innerHeight js/window)] | |
(gclasses/enable el class |
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
#!/usr/bin/env ruby | |
require 'base64' | |
require 'tempfile' | |
min, max = ARGV.map{|v| v.to_i} | |
raise "#{__FILE__} MIN MAX" unless min && max && min > 0 && min < max | |
MESSAGES = ["rechtop zitten!", "schouders naar achteren!", "stapelen!", "water drinken!"] |
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
namespace :i18n do | |
task en_bork: :environment do | |
I18n.locale = :en | |
en = I18n.t(".").except(:faker) | |
chef = replace_values!(en) do |val| | |
`echo #{val.inspect} | chef`.chomp.sub(/\s*Bork Bork Bork!/m, "") | |
end | |
File.open(Rails.root + "config/locales/en-bork.yml", "w") do |fd| |