Skip to content

Instantly share code, notes, and snippets.

View PaulCampbell's full-sized avatar

@paulcampbell_ PaulCampbell

  • UK
View GitHub Profile
@PaulCampbell
PaulCampbell / dotnet configuration with Rake
Created October 25, 2010 13:50
Basic rake script for configuring .net projects with yaml and configatron
require 'rake'
require 'configatron'
require 'pp'
task :setEnvironmentVariables do
$env = ENV['environment']
if $env.nil?
puts "Please enter an environment to deploy this build to."
fail
require 'rake'
require 'configatron'
require 'pp'
task :setEnvironmentVariables do
$env = ENV['environment']
if $env.nil?
puts "Please enter an environment to deploy this build to."
@PaulCampbell
PaulCampbell / IJsonService<T>
Created March 25, 2011 12:53
Generic repository style service for REST services
public interface IJsonService<T>
{
// Methods
void Delete(T entity);
IList<T> FindAll(IDictionary<string, object> propertyValuePairs, int pageNo, int resultsPerPage, string sortBy, string sortDirection);
T Get(int id);
IList<T> Get(List<int> IDs);
IList<T> GetAll(int pageNo, int resultsPerPage, string sortBy, string sortDirection, string segment);
RestResult Save(T entity);
RestResult Update(T entity);
[Test]
public void proclaimer_falls_down_at_door()
{
var proclaimer = nSubstitue.For<IProclaimer>();
proclaimer.Walk500Miles().Returns("One thousand miles walked");
var door = nSubstitue.For<IDoor>();
var sut = new ProclaimerGoesAboutHisBusinessService(proclaimer, door);
@PaulCampbell
PaulCampbell / RestSharpXmlSerializer
Created July 5, 2012 09:03
Overriding the rest# serialiser
public class RestSharpXmlSerializer : RestSharp.Serializers.ISerializer
{
public string Serialize(object obj)
{
string retval = null;
if (obj != null)
{
var sb = new StringBuilder();
using (var writer = XmlWriter.Create(sb, new XmlWriterSettings() { OmitXmlDeclaration = true }))
Having a wee bit o trouble with the async paradigm?
@PaulCampbell
PaulCampbell / gist:6544357
Created September 12, 2013 21:50
There;s 143 characters. Which goes into 11 13 times.
AWVLIQIQVTQOS
QOELGCVIIQWDL
CUQEEOENNWWOA
OLTDNUQTGAWTS
MDOQTLAOQSDCH
PQQIQDQQTQOOT
UDBNIQHBHHTDU
TEETFDUEAUMOR
ESQEQEMLTMETI
RECLICAIQATUN
@PaulCampbell
PaulCampbell / index.js
Created December 28, 2014 23:12
requirebin sketch
var plastiq = require('plastiq')
var h = plastiq.html;
var bind = plastiq.bind;
var recognition = new webkitSpeechRecognition();
var model = {query: ''}
function voiceSearch() {
return new Promise(function (result) {
@PaulCampbell
PaulCampbell / index.js
Created December 28, 2014 23:17 — forked from refractalize/index.js
requirebin sketch
var plastiq = require('plastiq');
var h = plastiq.html;
var bind = plastiq.bind;
function render(model) {
return h('div.asdasd',
h('label', "what's your name?"),
h('input', {type: 'text', model: bind(model, 'name')}),
h('div', 'hi ' + model.name)
);
@PaulCampbell
PaulCampbell / index.js
Created December 29, 2014 13:03
requirebin sketch
var _ = require('lodash')
var plastiq = require('plastiq')
var h = plastiq.html;
var bind = plastiq.bind;
var recognition = new webkitSpeechRecognition();
var model = {
query: '',
contacts: [