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
// Helper method enumerates over and returns lines in a file | |
static IEnumerable<string> ReadFrom(string file) | |
{ | |
string line; | |
using(var reader = System.IO.File.OpenText(file)) | |
{ | |
while((line = reader.ReadLine()) != null) | |
{ | |
yield return line; | |
} |
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
describe('housecat comparison', () => { | |
it('should let me know that both objects are the same', () => { | |
expect({ | |
name: 'Tiger', | |
species: 'Felis Catus', | |
favouriteSnack: 'Tuna', | |
schedule: { | |
breakfast: '08:00', | |
naptime: '10:00', |
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
expect({ | |
name: 'Tiger', | |
species: 'Felis Catus', | |
favouriteSnack: 'Tuna', | |
schedule: { | |
breakfast: '08:00', | |
naptime: '10:00', | |
dinner: '12:00', | |
tea: '18:00' | |
} |
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 Autofac; | |
using Autofac.Integration.Mvc; | |
using Autofac.Integration.WebApi; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Optimization; | |
using MyApp.Services; | |
using MyApp.Services.Interfaces; |
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 Autofac; | |
using Autofac.Integration.Mvc; | |
using Autofac.Integration.WebApi; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Optimization; | |
using MyApp.Services; | |
using MyApp.Services.Interfaces; |
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.Web; | |
using Umbraco.Core; | |
using Umbraco.Core.Models; | |
using Umbraco.Core.Services; | |
namespace MyApp.Services | |
{ |
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 Autofac; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Optimization; | |
using Umbraco.Core; | |
using Umbraco.Core.Services; | |
namespace MyApplication |
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
// React componey using the strategy pattern instead of switch | |
import React from 'react' | |
const Registration extends React.Component { | |
constructor(props) { | |
super(props) | |
} | |
render() { |
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
// Example of a React state. Manage this with Flux, Redux, black magic, etc... | |
import AccountFields from '../Components/AccountFields' | |
import SurveyFields from '../Components/SurveyFields' | |
import Confirmation from '../Components/Confirmation' | |
let pages = [ | |
{"Title": "Account Fields", "ActiveComponent": React.createFactory(AccountFields) }, | |
{"Title": "Survey Fields", "ActiveComponent": React.createFactory(SurveyFields) }, | |
{"Title": "Confirmation", "ActiveComponent": React.createFactory(Confirmation) } | |
] |
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
// Example. Let's sort the apples, pears, and oranges into the right baskets. | |
const fruits = ["apple", "pear", "apple", "apple", "orange", "pear", "orange", "pear", "apple"] | |
let appleBasket = [] | |
let pearBasket = [] | |
let orangeBasket = [] | |
let strategies = [] | |
const appleSortStrategy = (fruit) => { |