Skip to content

Instantly share code, notes, and snippets.

const person = { firstName: "Cedd", lastName: "Burge" };
return converge(compliment, [firstName, lastName])(person);
isIsogram :: String -> Bool
isIsogram = map toLower . filter isLetter . sort . group . all (length . (==1))
isIsogram :: String -> Bool
isIsogram = all ((1==) . length) . group . sort . filter isLetter . map toLower
public int? Accept(Reservation reservation)
{
if (!IsReservationInFuture(reservation))
return null;
try {
var reservedSeats =
ReadReservations(reservation.Date)
.Sum(r => r.Quantity);
public double CalculateDesignTurbulence(
double windSpeed,
double designTurbulence
double designTurbulenceShape)
{
return
designTurbulence
*
(
(
public double CalculateDesignTurbulence(double windSpeed, double designTurbulence, double designTurbulenceShape)
{
return designTurbulence * ((((15 / windSpeed) + designTurbulenceShape) / (1 + designTurbulenceShape)) + (1.28 / windSpeed * 1.44));
}
/*...*/ namespace BeerSong {
public class BeerSongGenerator {
public string Verses(int begin, int end) { /*...*/ return string.Join("\n", VersesList(begin, end)); }
IEnumerable<string> VersesList(int begin, int end) {
for (int verse = begin; verse >= end; verse--)
yield return Verse(verse); }
string Verse(int verse) => new VerseGenerator(verse).Verse; }
def count_neighbours(
point
, living_cells
):
@ceddlyburge
ceddlyburge / SpecificationSpecificVermeulenNearWakeLengthCalculatorPartial.cs
Created October 19, 2020 07:42
Example partial root setup class for CustomerTestsExcel framework
public partial class SpecificationSpecificVermeulenNearWakeLengthCalculator
{
// For the "Then" section, return the results to assert
internal IEnumerable<IVermeulenNearWakeLength> VermeulenNearWakeLengths { get; private set; }
// For the "When" section, exercising the system under test.
internal void Calculate()
{
VermeulenNearWakeLengths =
new VermeulenNearWakeLengthCalculator(
@ceddlyburge
ceddlyburge / SpecificationSpecificClassWithCustomPropertyPartial.cs
Last active October 19, 2020 07:39
Partial setup class for CustomerTestsExcel framework
public partial class SpecificationSpecificClassWithCustomProperty
{
internal SpecificationSpecificClassWithCustomProperty CustomInt_of(int customInt)
{
// The framework requires you to do this
AddValueProperty(GetCurrentMethod(), customInt);
// And then you can do some custom thing with `value` here
// classWithCustomProperty.Setup(m => m.Name).Returns(customInt.ToString());