I hereby claim:
- I am varyonic on github.
- I am piersc (https://keybase.io/piersc) on keybase.
- I have a public key whose fingerprint is 470E 0AE5 2340 04BF C6CE F9FD 3B88 5D68 B62E 5106
To claim this, I am signing this object:
| # See https://dondoh-blog.tumblr.com/post/4142258573/formtastic-without-activerecord | |
| # ------------------------------------------------------------------------------- | |
| # Faux model object that plays well with formtastic; this is used for example in | |
| # a contact form which generates a request to salesforce | |
| # ------------------------------------------------------------------------------- | |
| class FormtasticFauxModel | |
| include ActiveModel::Validations | |
| include ActiveModel::Conversion | |
| extend ActiveModel::Naming |
| gem 'active_model_serializers' | |
| gem 'activeadmin' | |
| gem 'jquery-ui-rails' |
I hereby claim:
To claim this, I am signing this object:
| web: | |
| build: . | |
| volumes: | |
| - .:/opt/myapp | |
| ports: | |
| - '3000:3000' | |
| links: | |
| - db | |
| - redis | |
| - selenium |
| # See https://codeship.com/documentation/docker/browser-testing/ | |
| FROM myapp:base | |
| # We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver | |
| RUN apt-get install -y wget xvfb unzip | |
| # Set up the Chrome PPA | |
| RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
| RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list |
| context "with inputs twice" do | |
| let :body do | |
| build_form do |f| | |
| f.inputs do |f| | |
| f.input :title | |
| f.input :body | |
| end | |
| f.inputs do |f| | |
| f.input :author | |
| f.input :published_at |
| module ActiveAdmin | |
| module Views | |
| class ActiveAdminForm | |
| class DeprecatedFormBufferSubstitute | |
| def initialize(form) | |
| @form = form | |
| end | |
| def << (value) | |
| @form.text_node value.html_safe | |
| end |
| require 'set' | |
| module NumberFinder | |
| # Most efficient solution for single number missing from sequence. | |
| def self.method1(arr) | |
| (arr.size+1)*(arr.size+2)/2 - arr.reduce(:+) | |
| end | |
| # Generic solution works with any quantity of missing numbers. |
| # inspired by https://gist.github.com/zachrose/7549941 | |
| module ActiveSupport::Inflector | |
| def nice_title(phrase) | |
| return phrase if phrase =~ /^-+$/ | |
| phrase.split('-').map { |part| | |
| if part.chars.count == part.bytes.count | |
| part.titleize | |
| else | |
| part.split(' ').map { |word| word.mb_chars.titleize }.join(' ') |