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
public OrderableService GetById(int id) | |
{ | |
return (from service in SourceSet | |
where service.ID == id | |
select service). | |
FirstOrDefault(); | |
} |
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 Xunit; | |
public class HelloWorldTests { | |
[Fact] | |
public void ShouldSayHello { | |
var listener = new Listener(); | |
var helloWorld = new HelloWorld(); | |
helloWorld.SayHello(listener.Listen); | |
Asser.Equal("Hello world", listener.ReceivedMessage) |
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
public OrderableService GetById(int id) | |
{ | |
return (from service in SourceSet | |
where service.ID == id | |
select service). | |
FirstOrDefault(); | |
} |
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
directive('ngThrottle', function () { | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link: function (scope, elm, attr, ngModelCtrl) { | |
if (attr.type === 'radio' || attr.type === 'checkbox') return; | |
elm.unbind('input').unbind('keydown').unbind('change'); | |
var disp = elm.keyupAsObservable(). | |
throttle(attr.ngThrottle). | |
select(function(){ return elm.val() }). |
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
<div ng-app="videoApp" ng-controller="VideoController"> | |
<table> | |
<thead> | |
<th>Title</th> | |
<th>Length</th> | |
<th></th> | |
</thead> | |
<tbody> | |
<tr data-id="{{video.Id}}" ng-repeat="video in videos"> |
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 rx-cljs-demo.client | |
(:use [domina :only [by-id]])) | |
(def query (by-id "query")) | |
(def obs (Rx/Observable/fromEvent query "keyup")) | |
(-> obs | |
(.map #(.-value query)) | |
(.filter #(> (count %) 3)) | |
(.throttle 500) |
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
public interface IStorage | |
{ | |
Uri Save(Stream data, string name); | |
Task<Stream> LoadAsync(Uri dataUri); | |
} |
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
static void Main() | |
{ | |
var service = new MyService | |
{ | |
ServiceName = ConfigurationManager.AppSettings["Service.Name"] | |
}; | |
#if DEBUG | |
service.OnStart(null); | |
Console.WriteLine("Press Ctrl+C to exit."); | |
var sync = new System.Threading.ManualResetEventSlim(false); |
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
public static class ParseEx { | |
public delegate bool ParserDelegate<T>(string input, out T result); | |
public static Maybe<T> Parse<T>(string input, ParserDelegate<T> parser) { | |
T result; | |
bool isSuccess = parser(input, out result); | |
return isSuccess ? result.ToMaybe() : new Nothing<T>(); | |
} | |
public static Maybe<DateTime> ParseDateTime(string input) { |
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
// before | |
var bdayEl = el.Descendant("DatumNarozeni"); | |
var birthday = bdayEl != null ? (DateTime?)Convert.ToDateTime(bdayEl.Value) : null; | |
// after Maybe | |
var birthday = from bday in el.Descendant("DatumNarozeni").ToMaybe() | |
select Convert.ToDateTime(bday.Value).ToMaybe(); |