Skip to content

Instantly share code, notes, and snippets.

(function($)
{
$.fn.myPlugin = function(optionsOrCommand, commandOptions)
{
if (optionsOrCommand == 'someCommand')
{
return this.each(function()
{
this.myPlugin.someOtherFunction();
});
var b=document.body;b.className=b.className?b.className+' js':'js';
<!-- use IE Conditional comments to add identifying wrapper
divs to support valid IE-version-specific CSS selectors
to target version-specific rendering bugs -->
<!--[if IE]><div id="ie"><![endif]--><!--[if IE 6]><div id="ie6"><![endif]--><!--[if IE 7]><div id="ie7"><![endif]--><!--[if IE 8]><div id="ie8"><![endif]-->
<!-- close our IE Conditional wrapper divs -->
<!--[if IE 8]></div><![endif]--><!--[if IE 7]></div><![endif]--><!--[if IE 6]></div><![endif]--><!--[if IE]></div><![endif]-->
@davidalpert
davidalpert / ListHelpers1.cs
Created August 9, 2010 15:25
ListHelpers - ToSelectItems(...)
public static IEnumerable<SelectListItem> ToSelectItems(this IEnumerable<String> items)
{
foreach (var item in items)
{
yield return new SelectListItem()
{
Text = item,
Value = item
};
}
dir Microsoft.* | foreach ($_) {dir $_.FullName -Recurse -Filter *.dll} | foreach ($_) {cp $_.FullName reference\}
@davidalpert
davidalpert / GetVersionStamp.cs
Created October 14, 2010 17:04
GetVersionStamp
/// <summary>
/// Gets the version stamp from your assembly info.
/// </summary>
/// <remarks>
/// source: http://mikehadlow.blogspot.com/2010/10/use-single-version-file-for-all.html
/// </remarks>
public string GetVersionStamp() {
Version v = Assembly.GetExecutingAssembly().GetName().Version;
string versionStamp = String.Format("Version: {0}.{1}.{2}.{3}", v.Major, v.Minor, v.Build, v.MinorRevision);
return versionStamp;
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Manos.Tool.Driver' threw an exception. ---> System.TypeLoadException: Could not load type 'Libev.Loop' from assembly 'manos, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
at Manos.Tool.Environment..ctor()
at Manos.Tool.Driver..cctor() in E:\Users\davida\lib\manos.git\src\manos.exe\Driver.cs:line 43
--- End of inner exception stack trace ---
at Manos.Tool.Driver.Main(String[] args)
david@WONDERLAND ~/dev/zenboard.git (master)
$ rake -T
c:/Ruby192/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find executable r
ake for rake-0.8.7 (Gem::Exception)
from c:/Ruby192/bin/rake:19:in `<main>'
@davidalpert
davidalpert / FluentValidation.Tests.ConditionTests.cs
Created February 10, 2011 07:15
FluentValidation.Tests.ConditionTests - Grouping Validation Conditions
private class GroupedWhenConditionValidator : ExpressiveValidator<Person>
{
public GroupedWhenConditionValidator()
{
When(x => x.Id != 0)
.Check(RuleFor(x => x.Age).GreaterThan(4))
.Check(RuleFor(x => x.Discount).Equal(10m));
}
}
@davidalpert
davidalpert / ChainedRuleFor.cs
Created February 10, 2011 18:46
Chained RuleFor (useful when several RuleFor's share a common predicate)
When(x => x.Id != 0)
.Check(RuleFor(x => x.Age).GreaterThan(4))
.Check(RuleFor(x => x.Discount).Equal(10m))
.Unless(x => x.Id == 5);
Check(RuleFor(x => x.Age).GreaterThan(4))
.Check(RuleFor(x => x.Discount).Equal(10m))
.Unless(x => x.Id == 5);