I hereby claim:
- I am joost on github.
- I am joosth (https://keybase.io/joosth) on keybase.
- I have a public key whose fingerprint is 3546 2624 A98A C4A1 2E7C 414D ABA4 5856 9272 EE8A
To claim this, I am signing this object:
export AZURE_PERSONAL_ACCESS_TOKEN=YOUR_AZURE_ACCESS_TOKEN | |
export AZURE_ORGANIZATION_URL=https://dev.azure.com/YOURORG |
FROM phusion/passenger-full | |
# Set correct environment variables. | |
ENV HOME /root | |
ENV RUBY_VERSION 2.2.1 | |
# Use baseimage-docker's init system. | |
CMD ["/sbin/my_init"] | |
# =================== |
def compare_yaml_hash(cf1, cf2, context = []) | |
cf1.each do |key, value| | |
unless cf2.key?(key) | |
puts "Missing key : #{key} in path #{context.join(".")}" | |
next | |
end | |
value2 = cf2[key] | |
if (value.class != value2.class) |
# Usage: | |
# https://gist.githubusercontent.com/joost/20934650f68dd561fc35/raw/44629ade560e0e546ac7d2f94537a594546c5e1f/docker_compose.rb | |
class DockerCompose < Formula | |
desc "Isolated development environments using Docker" | |
homepage "https://docs.docker.com/compose/" | |
url "https://github.com/docker/compose/archive/1.3.0rc2.tar.gz" | |
sha256 "4e0a6c82e283e44eb551a8e57bb40c1c2768f8acaf36eb7e858c99ca4fb3d0dc" | |
# bottle do | |
# sha256 "bf8a80a39a59185add39a12e6da2b53e19e08bb09d823b1cbaf2ffdcf797c3d7" => :yosemite |
# Steps we will take: | |
# 1. Change boot2docker image type (this will take long) | |
# 2. Resize image | |
# 3. Resize partion (using GParted) | |
# | |
# Also see: https://docs.docker.com/articles/b2d_volume_resize/ | |
# Stop boot2docker | |
boot2docker stop |
I hereby claim:
To claim this, I am signing this object:
class ApiController < ApplicationController | |
# FIXME: Since we cannot set ActionController::Parameters.action_on_unpermitted_parameters = :raise | |
# on a controller level we do this hotfix. | |
class ApiParameters < ActionController::Parameters | |
def action_on_unpermitted_parameters | |
:raise | |
end | |
end | |
def params |
class YourModel | |
# Overwrite sunspot version to not remove from index. | |
# See: https://github.com/sunspot/sunspot/blob/16e5f620814fd4bdf43e3df158e7fdcbbd92713b/sunspot_rails/lib/sunspot/rails/searchable.rb#L206 | |
def self.solr_reindex(options = {}) | |
solr_index(options) | |
solr_clean_index_orphans | |
end | |
end |
# Put this code in lib/validators/json_validator.rb | |
# Usage in your model: | |
# validates :json_attribute, presence: true, json: true | |
# | |
# To have a detailed error use something like: | |
# validates :json_attribute, presence: true, json: {message: :some_i18n_key} | |
# In your yaml use: | |
# some_i18n_key: "detailed exception message: %{exception_message}" | |
class JsonValidator < ActiveModel::EachValidator |
# Using v1 of Ruby aws-sdk as currently v2 seems not able to do this (broken?). | |
require 'aws-sdk-v1' | |
key = YOUR_AWS_KEY | |
secret = YOUR_AWS_SECRET | |
region = YOUR_AWS_REGION | |
AWS.config(access_key_id: key, secret_access_key: secret, region: region) | |
s3 = AWS::S3.new | |
bucket = s3.buckets[bucket_name] |