Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrik Tazer

View GitHub Profile
@Tazer
Tazer / keybase.md
Last active December 16, 2016 22:33
View keybase.md

Keybase proof

I hereby claim:

  • I am tazer on github.
  • I am rambo3swe (https://keybase.io/rambo3swe) on keybase.
  • I have a public key ASBASz7wstMwnwLc52BKAkAIateo8_qpFoncqmpADJmMkgo

To claim this, I am signing this object:

@Tazer
Tazer / CacheHelper.cs
Last active August 29, 2015 14:04
Getting cached results if available else use the Func and invoke an database GET
View CacheHelper.cs
public class CacheHelper : ICacheHelper
{
private readonly ICache _cache;
public CacheHelper(ICache cache)
{
this._cache = cache;
}
public IEnumerable<T> GetResult<T>(string cacheKey, Func<IEnumerable<T>> getDatabaseResultsFunc)
@Tazer
Tazer / robot.js
Created December 18, 2012 20:00
DeathAng3l2
View robot.js
// Conventions:
// We use angles in degrees in clock-wise fashion
RobotHelpers = {};
MathHelpers = {};
RobotHelpers.cannon_rotation_direction = {};
RobotHelpers.shoot = {};
RobotHelpers.target = {};
RobotHelpers.moving_direction = {};
View gist:2249205
var gatewaysByDestinationAndShipQuery = session.Query<Available_Gateway, Available_Gateways>();
foreach (var destination in destinations)
{
gatewaysByDestinationAndShipQuery = gatewaysByDestinationAndShipQuery.Where(x => x.PortCodes.Any(y => destination == y));
}
foreach (var ship in ships)
{
gatewaysByDestinationAndShipQuery = gatewaysByDestinationAndShipQuery.Where(x => x.ShipCodes.Any(y => ship == y));
}
View Exempel implementation
public class TheDefaultCategory : ICreateCriteria<Category>
{
public DetachedCriteria GetCriteria()
{
return DetachedCriteria.For<Category>().Add(Restrictions.Eq("Default", true));
}
}