This file contains 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
#lang racket | |
(require pict | |
rackunit) | |
; left and right are (or/c choice? team?) | |
; winner is (or/c #f team?) | |
(struct choice (left right winner) #:transparent) | |
(struct team (name strength) #:transparent) |
This file contains 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
#lang slideshow | |
(require slideshow/code) | |
(set-margin! 20) | |
(current-font-size 36) ; default is 32 | |
(slide | |
#:title "My Perspective" | |
(item "A long-time fan of static types") | |
(item "Respect that very good programmers disagree") |
This file contains 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
interface IDapperQuery<out TResult> | |
{ | |
string GetSql(); | |
DynamicParameters GetParameters(); // <--- can't make this work | |
IDictionary<string, object> GetParametersAsDict(); // this works | |
TResult MapResult(SqlMapper.GridReader reader); | |
} | |
// Combines both queries for one DB round trip | |
class CombinedQuery<T1, T2> : IDapperQuery<Tuple<T1, T2>> |
This file contains 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
if exists(select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = 'DropView') | |
drop procedure DropView; | |
go | |
create procedure DropView | |
@viewname varchar(99) | |
as | |
if exists(select * from INFORMATION_SCHEMA.VIEWS where TABLE_NAME = @viewname) | |
exec('drop view ' + @viewname); | |
go |
This file contains 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 Microsoft.VisualStudio.TestTools.UnitTesting; | |
using Autofac; | |
using Autofac.Core; | |
using System.Reflection; | |
using System.Linq.Expressions; | |
namespace test_autofac_generic_source |
This file contains 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
[TestMethod] | |
public void terse_test() | |
{ | |
doTheTest(); | |
// bucket # 01 02 03 04 05 06 07 08 09 10 11 12 | |
Assert.AreEqual(" | | 4| | 4|10| | 6| | 4| |10", TerseString()); | |
} | |
This file contains 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
// the code under test fills these buckets | |
private int?[] buckets; | |
[TestMethod] | |
public void verbose_test() | |
{ | |
doTheTest(); | |
Assert.IsNull(buckets[0]); | |
Assert.IsNull(buckets[1]); |
This file contains 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 Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
using System.Linq.Expressions; | |
namespace Mixer.Tests |
This file contains 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
class A<T> | |
{ | |
public string Foo { get { return "hello"; } } | |
} | |
class B<T> : A<T> { } | |
// this is OK (because A's generic parameter doesn't go to its base class?) | |
class Ok<T> : A<Ok<T>> { } |
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
autoReload="true"> | |
<!-- make sure to set 'Copy To Output Directory' option for this file --> | |
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information --> | |
<targets> | |
<target name="file" xsi:type="File" |
NewerOlder