#render string as slim template
example:
module WelcomeHelper
def tile_link_to(title, href, icon_content = nil, &block)
icon_content = capture { block.call }.strip.squish if block_given?
content = <<-slim
.tile
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
# lib/my-engine/simple-form.rb | |
require 'simple_form' | |
# https://gist.github.com/mark-d-holmberg/78f2909de5b59a09329c | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a | |
# complete input. You can remove any component from the | |
# wrapper, change the order or even add your own to the |
#render string as slim template
example:
module WelcomeHelper
def tile_link_to(title, href, icon_content = nil, &block)
icon_content = capture { block.call }.strip.squish if block_given?
content = <<-slim
.tile
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
PASSWORD_PATH = ".password" | |
PASSWORD_ID_PATH = ".password_id" | |
# Make sure to have installed vagrant-triggers plugin | |
# > vagrant plugin install vagrant-triggers | |
# After the first `vagrant up` stop the VM and execute the following steps |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
brew tap homebrew/versions | |
brew install v8-315 | |
gem install libv8 -v '3.16.14.13' -- --with-system-v8 | |
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315 | |
bundle install |
defmodule Map.Helpers do | |
@moduledoc """ | |
Functions to transform maps | |
""" | |
@doc """ | |
Convert map string camelCase keys to underscore_keys | |
""" | |
def underscore_keys(nil), do: nil |
#!/usr/bin/env ruby | |
# A sneaky wrapper around Rubocop that allows you to run it only against | |
# the recent changes, as opposed to the whole project. It lets you | |
# enforce the style guide for new/modified code only, as opposed to | |
# having to restyle everything or adding cops incrementally. It relies | |
# on git to figure out which files to check. | |
# | |
# Here are some options you can pass in addition to the ones in rubocop: | |
# |
defp upsert_profile(multi, source, source_uuid, profile_url) do | |
profile = %Profile{ | |
source: source, | |
source_uuid: source_uuid, | |
profile: profile_url, | |
} | |
Ecto.Multi.insert(multi, source_uuid, profile, on_conflict: [set: [profile: profile_url]], conflict_target: [:source, :source_uuid]) | |
end |