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() |
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 TemplateRenderer | |
attr_reader :parsed_template | |
def initialize(template) | |
@parsed_template = template.respond_to?(:parase) ? template : _parse_template(template) | |
end | |
def render(params) | |
_render_template params | |
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
http://phpconfigure.com/ | |
See before: | |
compile.mysql5.6.12.txt & compile.apache2.4.4.txt | |
Compile php 5.3.25 | |
sudo mkdir /usr/local/php | |
sudo mkdir /usr/local/php/php_5.3.25 |
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
<header> | |
<script type="text/html" id="options-template"> | |
<% for (i = 0; i < items.length; i++) { %> | |
<option value="<%= items[i].id %>"><%= items[i].value %></option> | |
<% } %> | |
</script> | |
</header> |