Skip to content

Instantly share code, notes, and snippets.

View gshutler's full-sized avatar
📅
👨‍💻

Garry Shutler gshutler

📅
👨‍💻
View GitHub Profile
set transaction isolation level read uncommitted
select
c.[Id],
c.[Name],
c.[SentOn],
count(s.Id) as sent,
sum(s.[Bounced]) as bounced,
sum(s.[Complained]) as complained,
sum(s.[Opened]) as opened,
var compare = function (a, b) {
var i = 0;
for (; i < a.length; i++) {
if (a[i] != b[i]) {
return (a[i] > b[i]) ? 1 : -1;
}
}
return 0;
@gshutler
gshutler / generator.rb
Created July 1, 2012 16:26 — forked from karlseguin/gist:3016329
File-based score data
require 'digest'
require 'json'
require 'fileutils'
$leaderboard_count = 5
$user_count = 200000
def username(i)
Digest::SHA1.hexdigest(i.to_s)
end
@gshutler
gshutler / sketch.rb
Created June 29, 2012 16:04 — forked from mattwynne/sketch.rb
sketch for Matt Wynne
class Organization
def to_param
"42"
end
def saved?
rand > 0.5
end
end
class OrganizationCreator
var optionSet = new OptionSet
{
{"p|password=", "The password for each certificate", x => password = x},
{"f|format=", "The string format for certificate names", x => format = x}
};
var outputPath = optionSet.Parse(args).FirstOrDefault();
// Vessl e:\Export
// Vessl --password=foobar e:\Export
GET /users
Content-Type: application/json
Link: rel=page2;href=/users?page=2
{
page: 1,
total: 1111002324,
results: [
@gshutler
gshutler / DiffGenerator.cs
Created March 2, 2012 17:27 — forked from DominicFinn/DiffGenerator.cs
Two ways of generating the difference in between two lists
using System.Collections.Generic;
using System.Linq;
namespace Other.Something.Core.Tasks
{
public static class DiffGenerator
{
public static Diff<T> Generate<T>(IEnumerable<T> left, IEnumerable<T> right)
{
var added = right.Except(left);
public static class DiffGenerator
{
public Diff<T> Generate<T>(IEnumerable<T> left, IEnumerable<T> right)
{
var added = right.Except(left).ToList();
var removed = left.Except(right).ToList();
var leftList = left.ToList();
var common = right.Where(item => leftList.Contains(item)).ToList();
@gshutler
gshutler / about_scoring_project.rb
Created July 18, 2011 10:24 — forked from jakcharlton/about_scoring_project.rb
About Scoring from Ruby Koans
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
public class PageTemplateManager : IPageTemplateManager
{
readonly IReadModelRepository readModelRepository;
readonly object mutex;
readonly IDictionary<Guid, IList<PageTemplate>> templates;
public PageTemplateManager(IReadModelRepository readModelRepository)
{
this.readModelRepository = readModelRepository;
this.templates = new Dictionary<Guid, IList<PageTemplate>>();