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
;; Tomas Osland | |
;; [email protected] | |
;; @tomasosland | |
;; Welcome to this presentation about functional music. In this lightning talk we | |
;; will construct a drum machine and make som beats, play the piano, and experiment with synthesizers. | |
;; Start overtone.cid | |
(ns overtone.examples.timing.one-bar-sequencer |
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
function generateGrid() { | |
console.time('generate grid'); | |
var grid = []; | |
for(var i = 0; i < 10; i++) { | |
grid[i] = []; | |
for(var j = 0; j < 10; j++){ | |
grid[i][j] = {color: 'white'}; | |
} | |
} |
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
function exists(prev, num) { | |
return prev.indexOf(num) > -1; | |
} | |
function primeNumber(number, prev) { | |
var res = true; | |
for(var i = 2; i < Math.sqrt(number); i++) { | |
if((number % i) == 0) { | |
return false; |
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
function palindrome(number) { | |
n = number; | |
rev = 0; | |
while (number > 0) | |
{ | |
dig = number % 10; | |
rev = rev * 10 + dig; | |
number = Math.floor(number / 10); | |
} |
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
;; calc hours worked | |
(defun time-to-decimal (time) | |
(+ (floor time) (/ (* 100 (- time (floor time))) 60))) | |
(defun calc-hours-worked () | |
(interactive) | |
(setq line (buffer-substring-no-properties (line-beginning-position) (line-end-position))) | |
(string-match "[0-9]\\{2\\}\.[0-9]\\{2\\}" line) | |
(setq start (string-to-number (match-string 0 line))) | |
(string-match "[0-9]\\{2\\}\.[0-9]\\{2\\}" line 5) |