Skip to content

Instantly share code, notes, and snippets.

View jasondentler's full-sized avatar

Jason Dentler jasondentler

View GitHub Profile
@jasondentler
jasondentler / resultsets.cs
Created January 21, 2012 16:37
Simple.Data.RawSql blog code
const string sql = @"
-- Data Query
SELECT TOP 5 Album.AlbumId, Artist.Name, Album.Title
FROM Artist
INNER JOIN Album
ON Album.ArtistId = Artist.ArtistId
WHERE Album.Title LIKE @filter
ORDER BY Album.Title, Artist.Name;
-- Count Query
function print(value) {
if (typeof(value) == 'string')
return WScript.stdout.write(value);
if (typeof(value) == 'number') {
if (isNaN(value))
return WScript.stdout.write('NaN');
return WScript.stdout.write(value);
}
if (value == null)
return print("null");
@jasondentler
jasondentler / DataReaderExtensions.cs
Created January 17, 2012 11:16
Simple.Data extensions
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Simple.Data.Ado;
namespace Simple.Data.Sql
{
public static class DataReaderExtensions
{
public static IEnumerable<IEnumerable<dynamic>> ToResultSets(this IDataReader reader)
@jasondentler
jasondentler / Account.hbm.xml
Created August 25, 2011 15:32
IUserType encrypted string
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="ACC.Testing.Core"
namespace="ACC.Testing">
<typedef class="ACC.Testing.Data.EncryptedString, ACC.Testing.Data" name="encrypted" />
<class name="Account">
<id name="Id">
<generator class="guid.comb" />
</id>
@jasondentler
jasondentler / FeedFixture.cs
Created July 19, 2011 13:34
Hermes feed fixture
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.ServiceModel.Syndication;
using System.Text;
using System.Xml;
using Autofac;
using Moq;
@jasondentler
jasondentler / ChatClient.js
Created July 17, 2011 12:55
Hermes code examples
$(function () {
$('#chatBox').focus();
var topic = new HermesClient("http://localhost:6156/")
.TryCreateGroup("Chat Server")
.TryCreateTopic("Weather Channel");
topic.fail(function () { alert('Unable to connect to Hermes server'); });
// Check for new messages every 1/2 second
<script id="itemListTemplate" src="/Templates/itemList.tmpl.html" type="text/html"></script>
<script type="text/javascript">
model = @Model.ToJson();
</script>
NAnt 0.91 (Build 0.91.3881.0; alpha2; 8/17/2010)
Copyright (C) 2001-2010 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///c:/myNcqrsBuilder/ncqrs-ncqrs-67366fc/MAIN.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build
build:
NAnt 0.91 (Build 0.91.3881.0; alpha2; 8/17/2010)
Copyright (C) 2001-2010 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///c:/myNcqrsBuilder/ncqrs-ncqrs-67366fc/MAIN.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build
build: