Skip to content

Instantly share code, notes, and snippets.

@Pondidum
Pondidum / Test.cs
Created October 18, 2015 21:11
Structuremap response
[Fact]
public void Can_resolve_action()
{
Action<TokenizerConfigurator> action = config =>
{
/* whatever */
};
var container = new Container(c =>
{
local isEmpty = function(t)
return next(t) == nil
-- for k,v in pairs(t) do
-- return false
-- end
-- return true
end
local System = {
@Pondidum
Pondidum / Program.cs
Created January 22, 2015 00:41
SelfHost.WebApi with wildcard routing
class Program
{
static void Main(string[] args)
{
var config = new HttpSelfHostConfiguration("http://localhost:62731/");
config.Routes.MapHttpRoute(
"CrossDomain", "{*args}",
new { controller = "CrossDomain" });
@Pondidum
Pondidum / inheritance.lua
Created November 25, 2014 15:04
Inheritance
local class = {
extend = function(self, this)
--i could put this method on class itself,
--but then i couldnt completely close over the self/base var
local base = self
this.super = function(child)
@Pondidum
Pondidum / wow-class-spec-dsl.lua
Last active August 29, 2015 14:04
DSL for class+spec loading
local environment = {
create = function()
local env = {}
env.case = function(condition, resultTable)
return function()
@Pondidum
Pondidum / InternalRegistry.cs
Last active August 29, 2015 14:00
Structuremap Factory Configuration
public class InternalRegistry : Registry
{
public InternalRegistry()
{
Scan(s =>
{
s.TheCallingAssembly();
s.WithDefaultConventions();
s.AddAllTypesOf<IViewRenderer>();
});
<viewdata model="EmbeddedSharpFubuSite.HomeViewModel" />
<h1>Hi, I'm an index.</h1>
public class EventDistributor
{
private readonly Dictionary<Type, List<WeakReference>> _events;
private static readonly Object Padlock = new Object();
public Distributor()
{
_events = new Dictionary<Type, List<WeakReference>>();
}
#showtooltip Mana Tide Totem
/script local m,s,d='', GetSpellCooldown("Mana Tide Totem");if s==0 then m="Tide Down";else m="Tide CD remaining: "..floor(s+d-GetTime()).."s";end;SendChatMessage(m, "CHANNEL",nil,7)
/cast Mana Tide Totem
@Pondidum
Pondidum / replace.sh
Created September 23, 2011 08:06
Delete matching lines in files
#!/bin/bash
files=$(find . -type f -name '*.Designer.vb' -print0 | xargs -0 grep -l 'TextReadOnly = False')
for file in $files
do
sed '/TextReadOnly = False/ d' $file >$file.tmp
mv $file.tmp $file
done