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 expect = require("expect.js"); | |
// Characterization tests using Mocha and expect.js to understand how | |
// functional references in JavaScript work | |
// See http://comp-phil.blogspot.com/2014/02/fun-with-function-references-in.html | |
// examples based on https://leanpub.com/javascript-allonge/read#recursive | |
describe("Let's play around with function references", function(){ | |
describe("Simple function examples", 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
var expect = require("expect.js"), | |
_ = require("underscore"), | |
increment = function(x){return ++x;}; | |
// Characterization tests using Mocha and expect.js to understand how | |
// underscore compose works | |
// See http://comp-phil.blogspot.com/2014/02/bird-watching-with-javascript-bluebird.html | |
describe("Let's figure out how underscore's compose function works", function(){ | |
describe("Simple function examples", 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
var expect = require("expect.js"), | |
allonges = require("allong.es").allong.es, | |
curry = allonges.curry, | |
map = allonges.map, | |
compose = allonges.compose, | |
identity = require('oscin.es').I; | |
// Example of currying in JavaScript | |
// See http://comp-phil.blogspot.com/2014/03/currying-in-javascript.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
var _ = require("underscore"), | |
expect = require("expect.js"); | |
// Characterization tests using Mocha and expect.js to understand how | |
// underscore.js' constant function works | |
// See http://comp-phil.blogspot.com/2014/03/bird-watching-with-javascript-kestrel.html | |
describe("Verify that we understand how underscore.js' constant works", function(){ | |
it("Constat will return a function", function(){ | |
expect(_.constant("Hello world")).to.be.a("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
var _ = require("underscore"), | |
send = require("allong.es").allong.es.send, | |
expect = require("expect.js"); | |
// Characterization tests using Mocha and expect.js to understand how | |
// underscore.js' tap function works | |
// See http://comp-phil.blogspot.com/2014/03/bird-watching-with-javascript-kestrel.html | |
describe("Verify that we understand how tap works", function(){ | |
describe("Call tap with a value", 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
;WITH cte(value, id) AS ( | |
SELECT * | |
FROM ( | |
VALUES | |
('HERP DREP CHS XMS', 1) | |
,('HELLO WORLD', 2) | |
) AS x(a, b) | |
) | |
SELECT | |
flags.flag.value('.', 'varchar(50)') AS Flag |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace FizzBuzz | |
{ | |
public class FizzBuzzer | |
{ | |
public string Translate(int value) | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CoinChanger | |
{ | |
public class Changer | |
{ |
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
namespace FizzBuzzPropertyTests | |
// example of FsCheck showing different ways to restricted FizzBuzz testing | |
open Xunit | |
open FsCheck | |
open FsCheck.Xunit | |
open FizzBuzz | |
module ``FizzBuzz Property tests`` = |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace RomanNumerals | |
{ | |
public class RomanNumeraler | |
{ |
OlderNewer