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
// Add as browser bookmark: | |
// javascript:(function(){var d=document,s=d.createElement('scr'+'ipt'),b=d.body,l=d.location;s.setAttribute('src','https://raw.github.com/gist/4213877/pretty.js');b.appendChild(s)})(); | |
// Loads javascript | |
// note that callback function needs be before calling loadJS(or inline) | |
// loadJS("http://code.jquery.com/jquery-latest.js", function() { $('my_element').hide(); }); | |
var loadJS = function (url, callback) { | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
script.src = url; |
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
// used here: https://gist.github.com/3665292 | |
// loadJS('https://raw.github.com/gist/3736933/jgrowl.js', function(){ createGrowl("title", "content", false); }); | |
// Loads javascript | |
// note that callback function needs be before calling loadJS(or inline) | |
// loadJS("http://code.jquery.com/jquery-latest.js", function() { $('my_element').hide(); }); | |
var loadJS = function (url, callback) { | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); |
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
// Bookmark: | |
// javascript:(function(){var d=document,s=d.createElement('scr'+'ipt'),b=d.body,l=d.location;s.setAttribute('src','https://raw.github.com/gist/3665292/elements_tracking_debug.js');b.appendChild(s)})(); | |
// loads javascript and executes some code when jQuery is loaded | |
// note that callback function needs be before calling loadJS(or inline) | |
// loadJS("http://code.jquery.com/jquery-latest.js", function() { $('my_element').hide(); }); | |
var loadJS = function (url, callback) { | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
script.src = url; |
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
;; 5 samples => 2.9595399991095066 | |
(mean (for [_ (range 10000)] (abs (- (mean weights) (mean (sample weights :size 5)))))) | |
;; 10 samples => 2.0840500000983475 | |
(mean (for [_ (range 10000)] (abs (- (mean weights) (mean (sample weights :size 10)))))) | |
;; 40 samples => 1.0537100001504645 | |
(mean (for [_ (range 10000)] (abs (- (mean weights) (mean (sample weights :size 40)))))) |
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
(use '(incanter core stats charts)) | |
;; weights (in grams) of 50 randomly sampled bags of preztels | |
(def weights [464 447 446 454 450 457 450 442 | |
433 452 449 454 450 438 448 449 | |
457 451 456 452 450 463 464 453 | |
452 447 439 449 468 443 433 460 | |
452 447 447 446 450 459 466 433 | |
445 453 454 446 464 450 456 456 | |
447 469]) |
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 sample-mean-error | |
[tdata tsize] | |
(mean (for [_ (range 10000)] | |
(abs (- (mean tdata) | |
(mean (sample tdata :size tsize))))))) | |
(defn progressive-sample-mean-error | |
[tdata] | |
(for [tx (range 2 (count tdata))] | |
(sample-mean-error tdata tx))) |
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
(defmethod report :summary [m] | |
(with-test-out | |
(twitter-update (str "[coverager] " (:fail m) " failures, " (:error m) " errors.")) | |
(println "\nRan" (:test m) "tests containing" | |
(+ (:pass m) (:fail m) (:error m)) "assertions.") | |
(println (:fail m) "failures," (:error m) "errors."))) |
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
(defmethod report :summary [m] | |
(with-test-out | |
(println "\nRan" (:test m) "tests containing" | |
(+ (:pass m) (:fail m) (:error m)) "assertions.") | |
(println (:fail m) "failures," (:error m) "errors."))) |
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
(import 'winterwell.jtwitter.Twitter) | |
(defn twitter-update [the_message] | |
(let [twitter (new Twitter "username" "password")] | |
(.updateStatus twitter the_message))) |
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 coverager | |
(:import (com.thoughtworks.selenium DefaultSelenium) | |
(org.openqa.selenium.server SeleniumServer) | |
java.util.Date | |
(java.io FileWriter) | |
(java.text SimpleDateFormat)) | |
(:use clojure.contrib.zip-filter.xml) | |
(:require [clojure.zip :as zip] | |
[clojure.xml :as xml])) |
NewerOlder