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 NamedCommand : ICommand | |
{ | |
public NamedCommand(ICommand decoratedCommand, string name) | |
{ | |
_DecoratedCommand = decoratedCommand; | |
Name = name; | |
} | |
readonly ICommand _DecoratedCommand; | |
public string Name { 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
/// <summary> | |
/// Returns true if the object is the type of T | |
/// </summary> | |
public static bool IsTypeOf<T>(this object o) | |
{ | |
return o.GetType() == typeof (T); | |
} |
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 interface ITranslator | |
{ | |
} | |
public class ClientATranslator : ITranslator | |
{ | |
} | |
public class ClientBTranslator : ITranslator | |
{ |
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
[TestMethod] | |
public void should_set_parameter() | |
{ | |
var message = new Message() as dynamic; | |
message.Foo = "foo"; | |
var foo = message.Foo as string; | |
foo.ShouldBe("foo"); | |
} |
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
string showAs = _defaultShowAs; | |
if (route.Contains(KnownParameters.ShowAs)) | |
{ | |
showAs = route[KnownParameters.ShowAs].ToString(); | |
} | |
/// AND | |
public override bool CanProcessFilter(IRoute route) |
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
d3.select("#make-table") | |
.append("tr") | |
.selectAll("td") | |
.data(data) | |
.enter() | |
.append("td") | |
.text(function(d) { | |
return d.value; | |
}); |
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
SurvivorContest.where("finalized = false and cancelled = false").each do |contest| | |
# do nothing | |
round = contest.active_round | |
if round.present? | |
if round.syncable? | |
round.match_ups.where(syncable: true).find_each do |match_up| | |
# do nothing | |
end | |
# round.match_ups.syncable.each do |match_up| | |
# SyncMatchUpWorker.queue(match_up.id, @options) |
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 Trading::CalculatePosition | |
def self.execute(user, contender, options={}) | |
position = user.positions.where(contender_id: contender.id).first | |
contracts = user.contracts | |
.select{|c| c.contender_id == contender.id} | |
.sort{|x,y| x.created_at <=> y.created_at } | |
if contracts.empty? |
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
# Submit the homework by pasting the code in a gist and emailing JB the url to the gist | |
# Assign "Hello World" to a variable message | |
# Assign a different string to a different variable | |
# Assign a number to a variable | |
# Use string interpolation to display the number in a string | |
# string interpolation = #{} |
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
Too many opinions. Too many white papers. | |
GET /things | |
returns collection of things | |
POST /things | |
adds an item to things | |
GET /things/100 | |
returns a thing with id 100 |
OlderNewer