Skip to content

Instantly share code, notes, and snippets.

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

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
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
// Conventions:
// We use angles in degrees in clock-wise fashion
RobotHelpers = {};
MathHelpers = {};
RobotHelpers.cannon_rotation_direction = {};
RobotHelpers.shoot = {};
RobotHelpers.target = {};
RobotHelpers.moving_direction = {};
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));
}
public class TheDefaultCategory : ICreateCriteria<Category>
{
public DetachedCriteria GetCriteria()
{
return DetachedCriteria.For<Category>().Add(Restrictions.Eq("Default", true));
}
}