docker build -t 'my_image_name:latest' . && tutum image push my_image_name:latest
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
version: 2 | |
jobs: | |
build: | |
parallelism: 3 | |
working_directory: ~/foo/bar | |
docker: | |
- image: circleci/ruby:2.3-node-browsers | |
- image: circleci/postgres:9.4 | |
- image: circleci/redis:3.2 | |
- image: circleci/rabbitmq:3.6.6 |
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 ActionView | |
module Helpers | |
module AssetUrlHelper | |
def asset_data_base64(path) | |
asset = Rails.application.assets.find_asset(path) | |
throw "Could not find asset '#{path}'" if asset.nil? | |
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "") | |
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}" | |
end | |
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
def flatten_array(arr) | |
arr.reduce([]) do |res, item| | |
item.kind_of?(Array) ? res + flatten_array(item) : res << item | |
end | |
end | |
# flatten_array( [[1,2,[3]],4]) |
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
packages: | |
yum: | |
git: [] | |
option_settings: | |
aws:elasticbeanstalk:application:environment: | |
BUNDLE_WITHOUT: test:development |
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
0xFCb2654F0Eaf900534C1b4E876b9ED5e00a267c9 |
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
# SSL Optional | |
listen 443 ssl default_server; | |
listen [::]:443 ssl default_server; | |
ssl_certificate /etc/ssl/my_cert.pem; | |
ssl_certificate_key /etc/ssl/my_cert.key; | |
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
// To format a private key into a string literal | |
cat my_secret.key | sed s/$/\\\\n/ | tr -d '\n' | |
echo $MY_SECRET_KEY | sed 's/\\n/\n/g' > ~/my_secret.key | |
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
// Given a positive integer of up to 16 digits, return true if it is a valid credit card number, and false if it is not. Here is the algorithm: | |
// If there are an even number of digits, double every other digit starting with the first, and if there are an odd number of digits, double every other digit starting with the second. Another way to think about it is, from the right to left, double every other digit starting with the second to last digit. | |
// 1714 => [1*, 7, 1*, 4] => [2, 7, 2, 4] | |
// 12345 => [1, 2*, 3, 4*, 5] => [1, 4, 3, 8, 5] | |
// 891 => [8, 9*, 1] => [8, 18, 1] | |
// If a resulting doubled number is greater than 9, replace it with either the sum of it's own digits, or 9 subtracted from it. |
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
dependencies: | |
pre: | |
- bundle config without development:production |