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
module Fubarizable | |
def fubarize | |
"foobar-#{fubarizable}-foobar" | |
end | |
end | |
class FakeFoobar | |
include Fubarizable | |
def fubarizable |
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
#!/bin/sh | |
docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.4.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
title Designing End To End Test | |
Test->ApplicationRunner: perform_foobar_for(order) | |
ApplicationRunner->OrderPage: perform_action(Order::ACTION_FOOBAR) | |
OrderPage->CapybaraPage: visit('/orders/order.id') | |
OrderPage->CapybaraPage: click(text) | |
Test->ApplicationRunner: has_shown_foobar_status_for(order) | |
ApplicationRunner->OrderPage: shows_status(Order::STATUS_FOOBAR) | |
OrderPage->CapybaraPage: visit('/orders/order.id') | |
OrderPage->CapybaraPage: assert_text(text) |
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 greeting | |
puts 'hello, world!' | |
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
require 'money' | |
class BigMoney | |
class << self | |
attr_accessor :current_currency | |
def force_currency(currency_code) | |
self.current_currency = Money::Currency.new(currency_code) | |
yield | |
self.current_currency = nil |
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 'active_record' | |
require 'database_cleaner' | |
require 'yaml' | |
connection_info = YAML.load(ERB.new(File.read("config/database.yml")).result)["test"] | |
ActiveRecord::Base.establish_connection(connection_info) | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction |
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
## | |
# Converts MTS files into m4v in a bulk | |
# with avconvert tool | |
# | |
# Usage: | |
# create directories ./in and ./out | |
# put files into in directory | |
# run the command: | |
# python bulk_convert.py | |
## |
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 'httparty' | |
require_relative 'pact_helper' | |
require 'webmock/rspec' | |
require 'byebug' | |
require 'rack/proxy' | |
WebMock.disable_net_connect!(allow_localhost: true) | |
class Alligator | |
attr_reader :name |
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
# List unique values in a DataFrame column | |
pd.unique(df.column_name.ravel()) | |
# Convert Series datatype to numeric, getting rid of any non-numeric values | |
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
# Grab DataFrame rows where column has certain values | |
valuelist = ['value1', 'value2', 'value3'] | |
df = df[df.column.isin(valuelist)] |
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
describe 'ProductsApp.List', -> | |
List = App.module "ProductsApp.List" | |
describe 'Products', -> | |
productsView = new List.Products | |
collection: new Backbone.Collection [] | |
describe 'click .publish_selected', -> | |
it 'triggers publish:selected:clicked event', -> | |
expect(true).toBeTruthy() |