Skip to content

Instantly share code, notes, and snippets.

View RookieOne's full-sized avatar

Jonathan Birkholz RookieOne

View GitHub Profile
public class NamedCommand : ICommand
{
public NamedCommand(ICommand decoratedCommand, string name)
{
_DecoratedCommand = decoratedCommand;
Name = name;
}
readonly ICommand _DecoratedCommand;
public string Name { get; set; }
/// <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);
}
public interface ITranslator
{
}
public class ClientATranslator : ITranslator
{
}
public class ClientBTranslator : ITranslator
{
[TestMethod]
public void should_set_parameter()
{
var message = new Message() as dynamic;
message.Foo = "foo";
var foo = message.Foo as string;
foo.ShouldBe("foo");
}
string showAs = _defaultShowAs;
if (route.Contains(KnownParameters.ShowAs))
{
showAs = route[KnownParameters.ShowAs].ToString();
}
/// AND
public override bool CanProcessFilter(IRoute route)
d3.select("#make-table")
.append("tr")
.selectAll("td")
.data(data)
.enter()
.append("td")
.text(function(d) {
return d.value;
});
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)
@RookieOne
RookieOne / gist:7903276
Last active December 30, 2015 23:49
Blurst #1 2013 Calculate Position
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?
@RookieOne
RookieOne / tiy_rails_day1
Last active August 29, 2015 14:06
Iron Yard Day 1 - Rails Homework
# 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 = #{}
@RookieOne
RookieOne / gist:c778faa003411f1ddaa0
Created December 3, 2014 16:57
API Url Standard
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