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
#!/usr/bin/env ruby | |
# pre-commit git hook | |
# will run rspec if and only if current branch is master | |
# script adapted from http://book.git-scm.com/5_git_hooks.html | |
def run_tests | |
html_path = "/tmp/git_hook_spec_results.html" | |
`rspec -f p -f h -o #{html_path} spec` # run the spec. send progress to screen. save html results to html_path |
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
class ToHaml | |
def initialize(path) | |
@path = path | |
end | |
def convert! | |
Dir["#{@path}/**/*.erb"].each do |file| | |
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}` | |
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
def make_user(how_many) | |
count = 0 | |
tags = %w{ ancient brief early fast late long modern old old-fashioned quick rapid short slow swift young agreeable brave calm delightful eager faithful gentle happy jolly kind lively nice obedient proud relieved silly thankful victorious witty zealous big colossal fat gigantic great huge immense large mammoth massive miniature petite puny scrawny short small tall teeny teeny-tiny tiny } | |
how_many.times do | |
email = "david_#{count}@demainlalune.ch" | |
first_name = "david_#{count}" | |
last_name = "hodge_#{count}" |
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
function SetVideoTexture(resourceName:String) | |
{ | |
Debug.Log("changing video texture " + resourceName); | |
movieTexture = Resources.Load(resourceName) as MovieTexture; | |
if (movieTexture) | |
{ | |
movieTexture.Play(); |
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
# sae course | |
# problem solving with python | |
# make this script work | |
print make me work | |
print "i love video games"" | |
prinl 10 * "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
;; Take 1 (noter que lazy-cat retourne toujours une liste; | |
;; et que son implémentation utilise lazy-seq) | |
(defn iter1 [f x] (lazy-cat [x] (iter f (f x) ) ) ) | |
(= (take 5 (iter1 #(* 2 %) 1)) | |
[1 2 4 8 16]) | |
(= (take 100 (iter1 inc 0)) | |
(take 100 (range))) | |
(= (take 9 (iter1 #(inc (mod % 3)) 1)) | |
(take 9 (cycle [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
(fn flip-fn-args [f] | |
(fn [& rest] (apply f (reverse rest)))) |
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
(fn roman | |
([s] (roman (seq s) 0)) | |
([s v] | |
(let [c1 (first s) | |
c2 (second s) | |
c12 (list c1 c2)] | |
(if (empty? s) v | |
(cond | |
(= c12 '(\I \V)) (roman (drop 2 s) (+ v 4)) | |
(= c12 '(\I \X)) (roman (drop 2 s) (+ v 9)) |
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
(fn roman | |
([s] (roman (seq s) 0)) | |
([s v] | |
(let [ | |
rdigits {\M 1000, \D 500, \C 100, \L 50, \X 10, \V 5, \I 1} | |
sdigits {"IV" 4, "IX" 9, "XL" 40, "XC" 90, "CD" 400, "CM" 900} | |
c1 (first s) | |
c12 (str c1 (second s)) | |
v1 (get rdigits c1 0) | |
v12 (get sdigits c12)] |
OlderNewer