Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Batum paulbatum

View GitHub Profile
View gist:165134
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace BadChars.Tests
{
[TestFixture]
public class BadCharsTests
{
[Test]
View fnh hacks
if (componentMapping != null)
{
mapping.CompositeElement = componentMapping.GetCompositeElementMapping();
mapping.Relationship = null; // HACK: bad design
}
// HACK: Index only on list and map - shouldn't have to do this!
if (indexMapping != null && mapping is IIndexedCollectionMapping)
((IIndexedCollectionMapping)mapping).Index = indexMapping;
@paulbatum
paulbatum / gist:994550
Created May 27, 2011
This is just one reason why we need interface inheritance
View gist:994550
IList<string> list = new [] { "I", "declare", "you", "are", "mistaken", "sir" };
IEnumerable<string> youProposeIShouldNotBeAbleToDoThis = list;
// For the above code to work, IList<T> must inherit from IEnumerable<T>, i.e. interface inheritance must exist.
@paulbatum
paulbatum / HandRolledMock.cs
Created May 27, 2011 — forked from skoon/MostlyScottish.cs
Hand rolled mocks work fine, I don't get it?
View HandRolledMock.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceInheritanceMocking
{
class Program
{
static void Main(string[] args)
View input.coffee
game.input = (($, game) ->
updatePlayEnabled = ->
if($('#namebox').val().length == 0)
$('#playbutton').attr('disabled', 'disabled')
else
$('#playbutton').removeAttr('disabled')
bindKeyboardControls = (websocket) ->
moveKeyMap =
Down: ['down', 's']
View game.coffee
window.game = (($, JSON) ->
updateScoreboard = (gameState) ->
$('#scoreboard').html('SCORES<br/><br/>')
for name, player of gameState.players
$('<div>')
.html(name + ': ' + player.score)
.css('color', player.color)
.appendTo($('#scoreboard'))
View gist:1419708
private void DisconnectClient(string clientId)
{
ChatUser user = _service.DisconnectClient(clientId);
// There's no associated user for this client id
if (user == null)
{
return;
}
@paulbatum
paulbatum / zumo.ts
Created Oct 7, 2012
TypeScript declaration file for Windows Azure Mobile Services server scripts
View zumo.ts
// TypeScript declaration file for Windows Azure Mobile Services server scripts
// WORK IN PROGRESS
interface ZumoError {
}
interface StatusCodes {
OK: number;
NOT_FOUND: number;
@paulbatum
paulbatum / OUTPUT
Created Nov 25, 2012
Magic buckets
View OUTPUT
<foo>
this is from the script
</foo>
this is from a module
View PAX
while(true)
{
try
{
var url = "http://prime.paxsite.com";
var client = new HttpClient();
var response = await client.GetAsync(url);
if(response.IsSuccessStatusCode)
{
Process.Start(url);
You can’t perform that action at this time.