Skip to content

Instantly share code, notes, and snippets.

View danbarua's full-sized avatar

Dan Barua danbarua

  • GSK
  • United Kingdom
View GitHub Profile
@danbarua
danbarua / rakefile.rb
Created February 10, 2014 13:26
Albacore task to verify projects have StyleCop.MSBuild set up properly
desc "Checks .csproj files for StyleCop.MSBuild target"
task :verify_stylecop_msbuild do
projectFiles = FileList["./**/*.csproj"]
projectFiles.each{|f|
doc = Nokogiri::XML(File.open(f))
target = doc.css('PropertyGroup > StyleCopMSBuildTargetsFile')
if (target.empty?)
puts "#{f} has no stylecop.msbuild"
else
puts "#{f} is ok"
@danbarua
danbarua / gist:6520603
Created September 11, 2013 08:05
Custom version of EasyNetQ's AutoSubscriber
namespace Foo.Common.Messaging.EasyNetQ
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
@danbarua
danbarua / gist:6249022
Created August 16, 2013 11:04
Redis request logger for ServiceStack
using System;
using System.Collections.Generic;
using System.Linq;
using ServiceStack.Common.Web;
using ServiceStack.Redis;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Providers;
using ServiceStack.ServiceInterface.ServiceModel;
using ServiceStack.ServiceModel;
@danbarua
danbarua / RedisTextSearchExtensions.cs
Created April 23, 2013 10:10
Simple text search with ServiceStack.Redis, based on Antirez's 'AutoComplete with Redis' post http://oldblog.antirez.com/post/autocomplete-with-redis.html Add POCOs to the index like this: client.AddToTextIndex(dto, x => x.Name, x => x.Address); and search like this: client.SearchText<TModel>("foo");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using ServiceStack.Common.Utils;
using ServiceStack.Redis;
using ServiceStack.Text;
namespace RedisSearch
{
@danbarua
danbarua / gist:5356062
Last active November 23, 2016 06:22 — forked from HasAndries/gist:3135128
AngularJs directive for Bootstrap datepicker
angular.module('bDatepicker', []).
directive('bDatepicker', function(){
return {
require: '?ngModel',
restrict: 'A',
link: function ($scope, element, attrs, controller) {
var updateModel, onblur;
if (controller != null) {
@danbarua
danbarua / gist:3528413
Created August 30, 2012 13:21
RabbitMQ reliable consumer pattern
while (_isRunning)
{
try
{
if (channel == null || consumer == null)
{
try
{
_connection = factory.CreateConnection();
channel = _connection.CreateModel();
using System.Collections.Generic;
using System.Linq;
using NHibernate.Criterion;
using ServiceStack.Common;
using ServiceStack.NH.Core.Domain;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.ServiceModel;
namespace ServiceStack.NH.Web.App_Start
{