This file contains hidden or 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
require 'rest_client' | |
require 'json' | |
class HomeController < ApplicationController | |
def initialize | |
@queries = {:lines => | |
"SELECT * | |
WHERE |
This file contains hidden or 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
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; | |
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' | |
-> WITH GRANT OPTION; |
This file contains hidden or 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
(set! *print-length* 200) |
This file contains hidden or 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
require 'benchmark' | |
lengths = [10, 100 , 1000, 10000, 100000, 1000000] | |
Benchmark.bm do |x| | |
lengths.each do |length| | |
x.report("Length = #{length}\t\t\t") {(0...length.to_i).map{ ('a'..'z').to_a[rand(26)] }} | |
x.report("Same without rand = #{length}\t\t\t") {(0...length.to_i).map{ ('a'..'z').to_a[1] }} | |
x.report("Fixed characters Length = #{length}\t\t\t") {"x" * length} | |
end | |
end |
This file contains hidden or 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
(doseq [i [1 2 3 4]] (print i)) |
This file contains hidden or 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
"c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Metrics.exe" /f:*.dll /f:*.exe /o:metrics.xml /d:dependencies |
This file contains hidden or 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
(with-facebook-auth @facebook-auth-token (client/get [:me :friends] {:extract :data})) : | |
This file contains hidden or 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
(defmacro check [ code expected] | |
`(if (= ~code ~expected) | |
(do | |
(println "Success: " '~code " does indeed equal " ~expected ) true ) | |
(do | |
(println "FAIL: " '~code " does not sadly equal " ~expected ) false ))) | |
(check (+ 4 1) 4) ;; FAIL: (+ 4 1) does not sadly equal 4 | |
(check (range 4) 4) ;; Success: (range 4) does indeed equal [0 1 2 3] |
This file contains hidden or 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 overtone-xmas.bells | |
( :use [overtone.live] | |
[overtone.sc.machinery.defcgen])) | |
;;http://computermusicresource.com/Simple.bell.tutorial.html | |
(def dull-partials | |
[ | |
0.56 |
This file contains hidden or 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
(defcgen triangle-osc [freq phase {:default 0.0} harmonics {:default 40}] | |
(:ar (let | |
[ | |
harmonic-numbers (take harmonics (iterate (partial + 2) 1)) | |
cosines (set (map #(- (* 4 %) 1) (range 1 harmonics))) ;; every 4n -1 is | |
;; there a better way?! | |
] | |
(klang [ | |
(map #(* freq %) harmonic-numbers ) ;; harmonics | |
(map #(/ 1.0 (* % %)) harmonic-numbers) ;; inverse square ampl |
OlderNewer