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 request = WebRequest.Create("http://foo.com/users/123"); | |
request.Method = "GET"; | |
var response = (HttpWebResponse)webRequest.GetResponse(); | |
var data = string.Empty; | |
using (var stream = response.GetResponseStream()) | |
data = new StreamReader(stream).ReadToEnd(); | |
//However you want to deserialize | |
var user = Deserialize<User>(data); |
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
node.BaseType.IsGeneric && node.BaseType.Template == FrameworkAssemblies.Mscorlib.Types.SingleOrDefault(t => t.FullName == "System.Collections.Generic.List`1") |
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
class User | |
{ | |
User Doppelganger { get; set; } | |
string Name { get; set; } | |
} | |
var user = new User { Name = "Ben" }; | |
user.Doppelganger = user; | |
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 System.Linq; | |
using System.Collections.Generic; | |
namespace managers | |
{ | |
class MainClass | |
{ | |
class Employee |
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
days.collect {|d| Hpricot(d) }.each do |d| | |
rows = (d/"//table[contains(@id,'Timeslots')]/tbody/tr[not(@class)]").collect { |r| Slot.new r } | |
@days[Date.parse((d/".riTextBox").inner_text)] = rows | |
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
#Needed to pass each module to the cucumber World() method | |
#/helpers/foo_helper.rb | |
module FooHelpers | |
def foo() | |
puts "foo" | |
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
public class ReflectionBasedPresenterDiscoveryStrategy : IPresenterDiscoveryStrategy | |
{ | |
private readonly ViewPresenterTable _presenterTable; | |
public ReflectionBasedPresenterDiscoveryStrategy(params Assembly[] presenterAssemblies) | |
{ | |
_presenterTable = new ViewPresenterTable(presenterAssemblies); | |
} | |
public IEnumerable<PresenterDiscoveryResult> GetBindings(IEnumerable<object> hosts, IEnumerable<IView> viewInstances) |
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 When_there_are_100_bottles_of_beer_on_the_wall | |
{ | |
static Wall Wall; | |
Establish there_are = () => Wall = new Wall { NumberBottlesOfBeer = 100 }; | |
Because we_take_one_down_and_pass_it_around = () => Wall.TakeOneDownAndPassItAround(); | |
It should_only_have_99_bottles_of_beer_on_the_wall = () => Wall.NumberBottlesOfBeer.ShouldEqual(99); | |
} |
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 abstract class Query<T> : IQuery<T> | |
{ | |
private readonly ISession _session; | |
protected Query(ISession session) | |
{ | |
_session = session; | |
} | |
public abstract T Execute(); |
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
protected void Application_Start() | |
{ | |
XmlConfigurator.Configure(); | |
_log.Debug("Starting the application"); | |
ViewEngines.Engines.Clear(); | |
ViewEngines.Engines.Add(new AreaViewEngine()); |