This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is a model that will be used in each of the examples below. | |
public class Product | |
{ | |
public Product() | |
{ | |
// Default values are to be set here | |
Shipping = new Address(); | |
} | |
public ObjectId _id{get;set;} | |
public double Price{get;set;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var func = WrapLambda<Outie, Innie, bool>(j => j.BoolVal, "Inner").Compile(); | |
var resultTrue = func(new Outie { Inner = new Innie { BoolVal = true } }); | |
var resultFalse = func(new Outie { Inner = new Innie() }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
via: http://javascriptweblog.wordpress.com/2010/09/20/auto-generating-javascript-unit-tests/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+JavascriptJavascript+(JavaScript,+JavaScript) | |
*/ | |
var tester = { | |
testing: [], | |
console: window.console || {log: function(a) {window.status = a}, warn: alert}, | |
defineBaseTests: function() { | |
this.baseTestBefore = [this.argumentsDefinedTest, this.thisBindingTest]; | |
this.baseTestAfter = [this.returnTest]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'yaml' | |
class File | |
def writeline(value) | |
self.write(value + "\n") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://www.JSON.org/json2.js | |
2010-08-25 | |
Public Domain. | |
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
See http://www.JSON.org/js.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Manos; | |
namespace pies | |
{ | |
public class DBModule : ManosModule | |
{ | |
public DBModule () | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 0. find your XML feed url and combine it with | |
// (ex. 'http://news.google.com?output=rss&q=javascript') | |
var jsonFeed = 'http://jsonr.com/json/news.google.com?output=rss&q=javascript' | |
//1. get the json and apply it. | |
jQuery.getJSON(jsonFeed,null,function(jsonObj){ | |
//2. use the jsonObj for good. | |
alert(jsonObj); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChunkUtils | |
{ | |
public static IEnumerable<T> Chunk(Func<int,IEnumerable<T>> chunkFunc){ | |
var taken = 0; | |
var last = 0; | |
do{ | |
last = taken; | |
var values = chunkFunc(taken);//taken is the "skip" count, the "take" count will have been closed into the chunkFunc. | |
foreach(var v in values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# Schema version: 20110429204914 | |
# | |
# Table name: users | |
# | |
# id :integer not null, primary key | |
# full_name :string(255) | |
# email :string(255) | |
# salt :string(255) | |
# created_at :datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# Schema version: 20110430183939 | |
# | |
# Table name: projects | |
# | |
# id :integer not null, primary key | |
# name :string(255) | |
# created_at :datetime | |
# updated_at :datetime | |
# |