Skip to content

Instantly share code, notes, and snippets.

View JeremySkinner's full-sized avatar

Jeremy Skinner JeremySkinner

View GitHub Profile
return session.Query<PageContent>()
.Where(x => x.Menu.Id == menuId)
.ProjectAs(x => new Link(x.UrlName, x.Name, x.ShowInMenu));
@JeremySkinner
JeremySkinner / gist:149990
Created July 19, 2009 18:12
Validating a UCI: with or without linq
//Using linq
private bool HasCorrectCheckDigit(string uci) {
const string checkDigits = "ABCDEFGHKLMRTVWXY";
try {
int remainder = uci.Substring(0, 12)
.Aggregate(Pair.Create(0, 0), (progress, character) => {
int multiplier = 16 - progress.Second;
int value = Convert.ToInt32(uci[progress.Second].ToString()) * multiplier;
return Pair.Create(progress.First + value, progress.Second + 1);
@JeremySkinner
JeremySkinner / gist:151352
Created July 21, 2009 14:21
Using IE's CSS filter attribute with jQuery's fadeIn
$("#caption").css("filter", "alpha(opacity=75)");
$("#block").fadeIn(3000, function(){ $("#caption").fadeIn(2500)});
//Option 1:
RuleFor(x => x.Surname).Cascade.StopOnFirstFailure.NotNull().....
//Option 2:
RuleFor(x => x.Surname).Cascade(CascadeMode.StopOnFirstFailure).NotNull()....
<script type="text/javascript">
var person = { Name: "Jeremy", Id: 1 };
</script>
<input type="text" sys:value="{binding path=Name, source={{person}} }" />
var handlerInterface = typeof(MyHandler).GetInterfaces()[0]; //This implements IHandle<T> (eg IHandle<Foo>)
var commandType = handlerInterface.GetGenericArguments()[0]; //this is the type being handled, eg Foo
var maker = GetType().GetMethod("ResolveHandler", BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance);
var compiledDelegate = (Func<object>)Delegate.CreateDelegate(typeof(Func<object>), maker);
target copyFiles:
FileList.Create def(fl):
fl.Include("src/Phantom/bin/${configuration}/*.{dll,exe}")
fl.Include("License.html")
fl.ForEach def(file):
file.CopyTo("build")
with FileList():
.Include("src/Phantom/bin/${configuration}/*.{dll,exe}")
.Include("License.html")
.ForEach def(file):
file.CopyToDir("build/${configuration}")
var cfg = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005
.ProxyFactoryFactory(typeof(ProxyFactoryFactory).AssemblyQualifiedName)
.ConnectionString(conn => conn.FromConnectionStringWithKey("Web"))
).BuildConfiguration();
Clone as normal...
git clone git://...url...
Create and check out a local branch that tracks the remote branch
git checkout -b <branch name> --track origin/<remote branch name>
Pull changes into the branch:
git pull origin <remote name>