This file contains hidden or 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 Fund::CreateCallForm < BaseForm | |
| property :type | |
| property :fund | |
| validation do | |
| required(:type) { filled? & included_in?(TRANSACTION_TYPES['Fund::Call']) } | |
| end | |
| validation if: -> (results) { rebalance? } do | |
| required(:fund).filled |
This file contains hidden or 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 File.expand_path('../boot', __FILE__) | |
| require 'rails/all' | |
| # Require the gems listed in Gemfile, including any gems | |
| # you've limited to :test, :development, or :production. | |
| Bundler.require(:default, Rails.env) | |
| module FooBar | |
| class Application < Rails::Application |
This file contains hidden or 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
| # see the current limits | |
| $ sysctl -a | grep maxproc | |
| # increase it | |
| $ sudo sysctl -w kern.maxproc=xxxx | |
| $ sudo sysctl -w kern.maxprocperuid=xxx | |
| # run at startup | |
| $ sudo vim /etc/sysctl.conf |
This file contains hidden or 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 'selenium-webdriver' | |
| Selenium::WebDriver::Chrome.driver_path="/path/to/chrome_driver_binary/chromedriver" | |
| driver = Selenium::WebDriver.for :chrome | |
| driver.get("http://google.com") |
This file contains hidden or 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/bash | |
| if [[ "$1" != "" ]]; then | |
| S3BUCKETNAME="$1" | |
| else | |
| echo ERROR: Failed to supply S3 bucket name | |
| exit 1 | |
| fi | |
| aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public |
This file contains hidden or 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 'stringio' | |
| # Create StringIO object from binary data file | |
| StringIO.new(File.binread('pict.jpg'), 'rb') | |
| # Create StringIO object from text data file | |
| StringIO.new(File.read('memo.txt', encoding: Encoding::UTF_8), 'r') |