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 Aggregator | |
def initialize(target_filename, output_filename, pattern, output_file_type=nil) | |
@target_filename = target_filename | |
@output_filename = output_filename | |
@pattern = pattern | |
@output_file_type = output_file_type || "csv" | |
end | |
def run | |
open_files |
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
require 'github_api' | |
require 'io/console' | |
class Teams < Thor | |
include Thor::Actions | |
desc "ls", "list users in an organization" | |
def ls(org) | |
connenction = connect | |
members = connenction.orgs.members.list org |
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
RSpec.configure do |config| | |
config.before :suite do | |
# set up a global cleaning strategy | |
DatabaseCleaner.clean_with(:truncation) | |
# AR specific strategy | |
DatabaseCleaner[:active_record].strategy = :truncation | |
# Explicitly tell DatabaseCleaner what connection is AR | |
DatabaseCleaner[:active_record, connection: :pediafed_test] |
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
use core::rand::{Rng}; | |
struct Monster { | |
name: ~str, | |
health: HealthPoints, | |
mut speed: int, | |
mut charisma: int, | |
mut max_attack: int, | |
position: Position | |
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
seat_index = "seat-#{arc_index}" | |
if href = SEATS[seat_index]["link"] | |
if !@links then @links = exports ? this | |
if [email protected] then @links.hash = {} | |
@links.hash[seat_index] = href | |
d3.select(".#{seat_index}").on "click", -> | |
seat_index = this.classList[1] | |
href = window.links.hash[seat_index] | |
window.open href, "_blank" |
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
def create | |
# generic file specific code | |
if files = params.fetch(:flu_vaccine){{}}.fetch(:generic_files){nil} | |
@file_uploads = GenericFile.new files if files.fetch(:name) != "" | |
end | |
params.fetch(:flu_vaccine){{}}.delete :generic_files | |
# vaccine specific code | |
@vaccine = FluVaccine.new(params.fetch(:flu_vaccine){{}}) |
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 Object | |
def send_each(*methods) | |
methods.inject(self) do |o, m| | |
o.respond_to?(m) ? o.public_send(m) : o | |
end | |
end | |
end | |
class MethodSequence | |
def document_download_cells(object, name, icon_path) |
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
require "sugar" | |
dust = require "dust" | |
redis = require "redis" | |
client = redis.createClient() | |
clicker = (app) -> | |
client.get "clicker", (e,cr) -> | |
client.get "timed", (e,tr) -> | |
app.render index: {clicker: cr, timed: tr} |
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
w = 1000 | |
h = 500 | |
X = d3.scale.ordinal().domain([90]).rangePoints([0,w],1) | |
Y = d3.scale.ordinal().domain([180]).rangePoints([0,h],2) | |
upper_arc = d3.svg.arc() | |
.innerRadius(95) | |
.outerRadius(105) | |
.startAngle(0) | |
.endAngle(Math.PI) |
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
require "minitest_helper" | |
describe "Root path acceptance test" do | |
before do | |
@company1 = create(:awesome_sauce_llc, featured: true) | |
@company2 = create(:better_than_you_inc, featured: true) | |
end | |
describe "when not logged in" do | |
before { visit root_path } |