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
function AppViewModel(dataModel) { | |
// Private state | |
var self = this; | |
// Private operations | |
function cleanUpLocation() { | |
window.location.hash = ""; | |
if (typeof (history.pushState) !== "undefined") { | |
history.pushState("", document.title, location.pathname); |
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
public interface IFoo | |
{ | |
[Sql("select 1")] | |
int GetNumber(); | |
} | |
public interface IBar | |
{ |
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
public abstract class Testing : DbConnectionWrapper | |
{ | |
public bool CtorCalled { get; set; } | |
protected Testing(IDbConnection innerConnection) | |
: base(innerConnection) | |
{ | |
CtorCalled = true; | |
} | |
} |
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
/////////////////////////////////////////// | |
// Method #1 | |
// Uses a for loop and substring | |
/////////////////////////////////////////// | |
int letterCount = 0; | |
string strText = "Debugging"; | |
string letter; | |
for (int i = 0; i < strText.Length; i++) |
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
SELECT [Id], ROW_NUMBER() OVER(ORDER BY (SELECT NULL) [RowNumber] | |
FROM [Whatever] |
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
/* "Write a program that prints the numbers from 1 to 100. | |
But for multiples of three print “Fizz” instead of the number | |
and for the multiples of five print “Buzz”. | |
For numbers which are multiples of both three and five print “FizzBuzz”." */ | |
Console.Write(string.Join(Environment.NewLine, | |
from n in Enumerable.Range(1, 100) | |
let m3 = n % 3 == 0 ? "Fizz" : "" | |
let m5 = n % 5 == 0 ? "Buzz" : "" | |
let s = m3 + m5 |
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
void Main() | |
{ | |
var filePath = @"C:\Users\roverby\Desktop\New Text Document.txt"; | |
using (var reader = File.OpenText(filePath)) | |
{ | |
// if you can count on your text file being relatively small | |
// you can buffer the records into memory and use as many times | |
// as you like | |
var fileContents_Buffered = reader.ReadCsv().ToArray(); | |
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
string text = @" | |
FRONT MATTER | |
FRONT MATTER #2 | |
NAME: Billy B Goode | |
BIRTHDATE: 5/10/1984 | |
GENDER: Male | |
MIDDLE MATTER | |
MIDDLE MATTER #2 |
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
[Test] | |
public async void Sqlite_Orders_And_Returns_DateTimeOffsets_Correctly() | |
{ | |
using (var db = DatabaseBuilder.BuildDatabase()) | |
{ | |
db.ExecuteSql("CREATE TABLE \"Tests\" (\"Time\" TEXT NOT NULL)"); | |
var later = DateTimeOffset.Parse("10/23/2014 11:35:18 AM -04:00").ToLocalTime(); | |
var earlier = later.AddMinutes(-10).ToUniversalTime(); | |
var ordered = new[] {later, earlier}.OrderBy(x => x); |
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
public void Write(RecordBase record) | |
{ | |
if (record == null) | |
throw new ArgumentNullException("record"); | |
// we have something to write | |
var spec = Spec.GetRecordSpec(record); | |
if (spec == null) | |
throw new UnknownRecordTypeException("Unknown record type: " + record.GetType().FullName); |
OlderNewer