- YUI3 Test does not support Data Providers for Parameterized Testing. You are welcome to use the extremely hacky solution that I came up with.
- Because checking for failures (errors/exceptions) must be defined as a separate hash by name, you end up with a lot of duplication and potential for errors if you forget to rename the item in the "error" hash after renaming the test method.
- Because checking for failures (errors/exceptions) must be defined as a separate hash by name, you lose the ability to dynamically check for errors/exceptions.
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
<!doctype html> | |
<html> | |
<title>Test Console</title> | |
<body class="yui3-skin-sam"> | |
<div id="test-console"></div> | |
<script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script> | |
<script src="tests.js"></script> | |
</body> | |
</html> |
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
# Obtain the project (assumes you've forked it) | |
% cd ~/projects | |
% git clone [email protected]:wilmoore/sinatra.git && cd sinatra | |
% bundle install | |
# Run Tests | |
% bundle exec rake test |
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
// Coders, if your goal is to align foo and bar, using a <tab> character is | |
// incorrect. If your goal, however, is to create an additional level of | |
// indentation, then go you. Either way, with a tab size other than 4, this | |
// looks like shit. | |
var foo = 1, | |
bar = 2; |
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
Show hidden characters
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for [JSHint][1], using [JSHint example][2] | |
// and [Ory Band's example][3] as basis and setting config values to | |
// be most strict: | |
// | |
// * set all enforcing options to true |
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/node | |
/* butterfly state machine */ | |
var Egg = function(species) { | |
this.species = species; | |
console.log("An egg"); | |
this.hatch = function() { |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
Score: 17/20
The languages I missed were:
- Haskell - I'm a little surprised I missed this but I'm not terribly worried about it
- Cobol - I am very surprised I missed this one. The PROGRAM-ID keyword is a dead giveaway. Even worse was the review comments at the end for this question read "Once you've seen Cobol code, you can never forget it". Well, crap...I guess I must be dense.
- Fortran - Not surprised at all. I don't recall every reviewing a Fortran program in my life.
Further observations:
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
(use '[clojure.core.match :only [match]]) | |
(defn evaluate [env [sym x y]] | |
(match [sym] | |
['Number] x | |
['Add] (+ (evaluate env x) (evaluate env y)) | |
['Multiply] (* (evaluate env x) (evaluate env y)) | |
['Variable] (env x))) | |
(def environment {"a" 3, "b" 4, "c" 5}) |
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 wordify(string) { | |
var index = 0; | |
var word = ''; | |
var words = []; | |
var end = string.length - 1; | |
while(string[index] !== undefined) { | |
word += /^\s/.test(string[index]) ? '' : string[index]; | |
if (/\s/.test(string[index]) || index === end) { |