Skip to content

Instantly share code, notes, and snippets.

View paulbatum's full-sized avatar

Paul Batum paulbatum

View GitHub Profile
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);
@paulbatum
paulbatum / OUTPUT
Created November 25, 2012 18:36
Magic buckets
<foo>
this is from the script
</foo>
this is from a module
@paulbatum
paulbatum / zumo.ts
Created October 7, 2012 21:30
TypeScript declaration file for Windows Azure Mobile Services server scripts
// TypeScript declaration file for Windows Azure Mobile Services server scripts
// WORK IN PROGRESS
interface ZumoError {
}
interface StatusCodes {
OK: number;
NOT_FOUND: number;
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 / game.coffee
Created October 3, 2011 05:45
PushFrenzy game
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'))
@paulbatum
paulbatum / input.coffee
Created September 26, 2011 04:26
PushFrenzy input
game.input = (($, game) ->
updatePlayEnabled = ->
if($('#namebox').val().length == 0)
$('#playbutton').attr('disabled', 'disabled')
else
$('#playbutton').removeAttr('disabled')
bindKeyboardControls = (websocket) ->
moveKeyMap =
Down: ['down', 's']
@paulbatum
paulbatum / HandRolledMock.cs
Created May 27, 2011 05:16 — forked from skoon/MostlyScottish.cs
Hand rolled mocks work fine, I don't get it?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceInheritanceMocking
{
class Program
{
static void Main(string[] args)
@paulbatum
paulbatum / gist:994550
Created May 27, 2011 02:49
This is just one reason why we need interface inheritance
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.
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;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace BadChars.Tests
{
[TestFixture]
public class BadCharsTests
{
[Test]