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);
var util = require('util');
function insert(item, user, request) {
var result;
try
{
eval("result = " + item.code);
request.respond(200, result);
}
catch(error)
@paulbatum
paulbatum / gist:962d6268fd765f8ac8cb
Created August 19, 2014 04:55
Another RxUI bug?
[Fact]
public void CanStartGameWithThreeOrMorePlayers()
{
foreach (var i in Enumerable.Range(1, 7))
{
viewmodel.NewPlayerName = "Player" + i;
viewmodel.AddPlayer.Execute(null);
// Test passes with this assert present, fails with it commented out
//Assert.Equal(i >= 3, viewmodel.StartGame.CanExecute(null));
@paulbatum
paulbatum / gist:be5ce06e913a5d68f255
Created October 1, 2014 00:39
Memory allocation test
var memorySink = [];
exports.post = function(request, response) {
var sizeKB = request.query.kb || 1024;
var entry = { size: sizeKB, buffer: new Buffer(sizeKB * 1024) };
memorySink.push(entry);
response.send(statusCodes.OK);
};
@paulbatum
paulbatum / gist:638015245b48171cd434
Created October 4, 2014 19:57
NetworkActivityHandler
public class NetworkActivityHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
using (new NetworkActivityDisposable())
{
return base.SendAsync(request, cancellationToken);
}
}
@paulbatum
paulbatum / gist:06d26f2800820375959e
Created October 9, 2014 20:07
Evolve 2014 Resources for Mobile Services
Get started with Mobile Services:
http://aka.ms/mobileservices
Field Engineer Lite:
http://github.com/paulbatum/FieldEngineerLite
Full Field Engineer Sample (windows and xamarin):
http://aka.ms/MobileFieldEngineer
http://aka.ms/MobileFEXamarin
@paulbatum
paulbatum / gist:140dfa27c07b1f39575c
Last active August 29, 2015 14:14
Adding an alpha pack download to MultiMC
OK so you the alpha pack downloaded but you don't know how to run it? Here's how:
1. Download MultiMC http://multimc.org/
2. Run MultiMC. It will create an instances folder inside the MultiMC folder.
3. Add your minecraft account details to MultiMC using the button in the top right.
4. Extract the alpha pack to the instances folder. Make sure you end up with a file structure like \MultiMC\instances\ME^-1\minecraft
5. In MultiMC click the refresh button. The downloaded pack should appear.
6. Double click the pack to run it.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace BadChars.Tests
{
[TestFixture]
public class BadCharsTests
{
[Test]
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 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.