Install with Homebrew
brew install redis
Set up launchctl to auto start redis
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
/usr/local/opt/redis/
is a symlink to /usr/local/Cellar/redis/x.y.z
(e.g., 2.8.7
)
def prime?(n) | |
for i in 2 ... n/2 | |
return false if n % i == 0 | |
end | |
true | |
end | |
def palindrome? n | |
s = n.to_s | |
s.slice( 0, (s.length+1)/2 ) == s.reverse.slice( 0, (s.length+1)/2 ) |
# 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(' ') |
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. |
brew install redis
Set up launchctl to auto start redis
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
/usr/local/opt/redis/
is a symlink to /usr/local/Cellar/redis/x.y.z
(e.g., 2.8.7
)
module ActiveAdmin | |
module Views | |
class ActiveAdminForm | |
class DeprecatedFormBufferSubstitute | |
def initialize(form) | |
@form = form | |
end | |
def << (value) | |
@form.text_node value.html_safe | |
end |
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 |
# 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 |
web: | |
build: . | |
volumes: | |
- .:/opt/myapp | |
ports: | |
- '3000:3000' | |
links: | |
- db | |
- redis | |
- selenium |
I hereby claim:
To claim this, I am signing this object:
gem 'active_model_serializers' | |
gem 'activeadmin' | |
gem 'jquery-ui-rails' |