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
var Game = function(score) { | |
this.score = score || [0,0]; | |
}; | |
Game.prototype.isDeuce = function() { | |
return this.score[0] == 40 | |
&& this.score[1] == 40; | |
}; | |
Game.prototype.lost = function () { |
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 'speclj.core) | |
(require '[clojure.string :as str]) | |
(defn- assert-positives [s] | |
(if-let [neg (re-seq #"-\d+" s)] | |
(throw (Exception. (str "Unexpected negative numbers: " (str/join ", " neg)))))) | |
(defn- parse-input [s] | |
(if-let [[[_ sep text]] (re-seq #"//(.+)\n(.+)" s)] | |
[text sep] |
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
:dependencies [[org.clojure/clojure "1.7.0-alpha2"] | |
[http-kit "2.1.18"] | |
[enlive "1.1.5"] | |
[environ "0.5.0"] | |
[com.domkm/silk "0.0.1-SNAPSHOT" :exclusions [org.clojure/clojure]] | |
[prone "0.6.0"] | |
[ring "1.3.0"] | |
[ring/ring-defaults "0.1.0"] | |
[ring-basic-authentication "1.0.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
SelectableItem matchingItem = getItems().stream(). | |
filter(x -> x.getTitle().equals(title)). | |
findFirst(). | |
orElseGet(() -> SelectableItem.EMPTY); |
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 body-mass-index.core) | |
(defn calc [mass height] | |
(/ mass (* height height))) | |
(defn category [bmi] | |
(cond | |
(> bmi 30) ::obese | |
(> bmi 25) ::overweight | |
(< bmi 18.5) ::underweight |
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
<?php namespace BodyMassIndex; | |
abstract class Thresholds { | |
const UNDERWEIGHT = 18.5; | |
const OVERWEIGHT = 25; | |
const OBESE = 30; | |
} | |
/** | |
* Calculates Body Mass Index. |
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
#define LOG | |
using System; | |
using System.IO; | |
using System.Net; | |
using System.Xml; | |
using System.Text; | |
using System.Threading; | |
using System.Net.Sockets; | |
using System.Collections; |
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
modifier = <'.'> (title|classes|styles|align)* | |
title = <'('> #"[^\)]*" <')'> | |
classes = <'['> ident? (<ws> ident)* <']'> | |
styles = <'{'> declaration* <'}'> | |
align = halign|valign|halign valign|valign halign|ε | |
declaration = property <":" ows> value <";"?> | |
ws = #"\s+" | |
ows = #"\s*" | |
ident = #"#?-?[_a-zA-Z][_a-zA-Z0-9-]*" | |
property = #"-?[a-zA-Z][_a-zA-Z0-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
{:desc "TODO", | |
:version "0.0.1", | |
:source "TODO", | |
:behaviors "user.behaviors", | |
;; Do not edit - :dependencies are auto-generated | |
:dependencies { | |
"Bracket glow" "0.0.2", | |
"CSS" "0.0.6", | |
"Clojure" "0.1.1", | |
"Emmet" "0.0.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
var white = 'x'; | |
var black = 'y'; | |
var north = {o:"N"}; | |
var east = {o:"E"}; | |
var south = {o:"S"}; | |
var west = {o:"W"}; | |
north.right = function() { return east; } | |
north.left = function() { return west; } | |
east.right = function() { return south;} |