Skip to content

Instantly share code, notes, and snippets.

@Eibwen
Eibwen / estimationTest.html
Last active June 14, 2016 14:57
Story Point Estimation - Under development
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Canvas tutorial</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script src="estimationTest.js"></script>
<script>
var canvas, radius;
@Eibwen
Eibwen / CleanConsul.js
Last active March 3, 2016 21:05
Deregister services in Consul when they get messy
"use strict";
var request = require('request');
var HOST = "http://127.0.0.1:8500";
var SERVICE_LIST = "/v1/agent/services";
var SERVICE_DEREGISTER = "/v1/agent/service/deregister/";
request(HOST + SERVICE_LIST, (error, response, body) =>
@Eibwen
Eibwen / template.bat
Last active February 18, 2016 16:51
Useful windows batch file snippets
:: Check if argument equals string
if /i "%1" equ "/resume" (
echo Resuming now!
)
:: Allow argument, but override if needed
set action=%1
if "%action%"=="" (
set action=start
)
@Eibwen
Eibwen / CurryExtensions.cs
Last active October 26, 2016 16:14
C# Curry Extensions
///<summary>
///Saw a thing about Currying in javascript frameworks, thought I'd throw the ability to do similar in C#
/// (Somewhere in this https://news.ycombinator.com/item?id=8652348)
///</summary>
public static class CurryExtensions
{
//Supplying 1 value
public static Func<T2, TOut> Curry<T1, T2, TOut>(this Func<T1, T2, TOut> func, T1 value)
{
return x => func(value, x);
@Eibwen
Eibwen / FindUnusedCode_Proposal.cs
Created November 12, 2014 23:49
A proposal for tracking if code is EVER hit or not
void Main()
{
//Usage is simply, anywhere in the solution:
CodeCalledRepository.Instance.CodeHit(CodeCalled.OldAssEmail1);
//Result is:
Database.Dump("Result 1");
CodeCalledRepository.Instance.DEBUGDUMP();
@Eibwen
Eibwen / DebugTimerRepository.cs
Created November 12, 2014 16:30
DebugTimerRepository - Ability to sum time taken on tasks
/// <summary>
/// How to use this:
/// 1. Get the reference
/// a. Inject IDebugTimerRepository
/// b. call DebugTimerRepository.Instance
/// 2. Log values
/// a. Call _debugTimerRepository.AddValue(string label, long value)
/// Probably using value == Stopwatch.TotalMiliseconds
///
/// Option 2:
@Eibwen
Eibwen / AppleStoreProduct.js
Created November 3, 2014 18:49
Apple laptops research
var _ = require("underscore");
function AppleStoreProduct(baseData) {
_.extend(this, baseData);
}
var specsLookup = [
//Very specific ones... only single matches
{ match: /^(Refurbished |)(?:([0-9\.]+-inch) )?(MacBook (?:Air|Pro)) ([0-9\.]+ ?GHz) ([dD]ual-core|Quad-core) (Intel (?:Core )?(i5|i7))( with Retina Display|)$/,
@Eibwen
Eibwen / gist:8854805
Created February 6, 2014 23:39
JsFiddle links
Playing with HSL colors in javascript
http://jsfiddle.net/HfCw2/
@Eibwen
Eibwen / SemiGenericEncryption.cs
Created May 2, 2013 20:06
Trying to make a nicer interface for obtaining encryption/hash stream
void Main()
{
Guid UserGuid = new Guid("99a2caf0-0c9b-4452-9313-ff6a1d9786fa");
using (MemoryStream ms = new MemoryStream())
using (Stream cs = BasicGoodEncrypt(UserGuid, "imalittleteapot", ms))
{
}
}
@Eibwen
Eibwen / IFilterItem.cs
Created April 17, 2013 05:30
Fun with interfaces Any object or list of objects to formatted string
void Main()
{
_filters.Add("Integer", new FilterItem<int>(999));
_filters.Add("IntegerList", new FilterListItem<int>(new [] { 1, 2, 3, 863, 2452, 24 }));
_filters.Add("string", new FilterItem<string>("test str"));
foreach (var kvp in _filters)
{
kvp.Value.GetQueryString().Dump();
}