I hereby claim:
- I am parndt on github.
- I am parndt (https://keybase.io/parndt) on keybase.
- I have a public key ASBedwOL9mMqpqG9Zyam-KocYI2QMx8B_8VIonrOMV0Xzgo
To claim this, I am signing this object:
module MySlice | |
module Actions | |
module Thing | |
class CreateContract < Dry::Validation::Contract | |
params do | |
required(:name).filled(:str?) | |
optional(:email).maybe(:str?) | |
end | |
rule(:email) do |
I hereby claim:
To claim this, I am signing this object:
### RAILS 4.1 | |
# Doesn't work, due to the error: | |
# Asset filtered out and will not be served: add | |
# `Rails.application.config.assets.precompile += %w( refinery/refinery.css )` | |
# to `config/initializers/assets.rb` and restart your server | |
class MyEngine < Rails::Engine | |
# set the manifests and assets to be precompiled | |
initializer "refinery.assets.precompile" do |app| |
// Settings in here override those in "Default/Preferences.sublime-settings", a$ | |
// are overridden in turn by file type specific settings. | |
{ | |
"font_face": "Monaco", | |
"font_size": 15, | |
"draw_white_space": "selection", | |
"trim_trailing_white_space_on_save": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"tab_completion": true, |
# Rails 2, 3, 4, and Hanami console | |
function rc { | |
if [ -e "./script/console" ]; then | |
./script/console $@ | |
elif [ -e "./bin/rails" ]; then | |
./bin/rails console $@ | |
elif [ -e "./apps" ]; then | |
hanami console $@ | |
else | |
script/rails console $@ |
# Making fun of "bundler for elixir" | |
function bundle { | |
if [ -e "Gemfile" ]; then | |
command bundle $@ | |
elif [ -e "mix.exs" ]; then | |
if [[ $@ == update* ]]; then | |
command mix deps.$@ | |
else | |
command mix deps.get | |
fi; |
defmodule MyList do | |
def square([]), do: [] | |
def square([ head | tail]), do: [ head * head | square(tail) ] | |
def add_1([]), do: [] | |
def add_1([ head | tail ]), do: [ head + 1 | add_1(tail) ] | |
def map([], _func), do: [] | |
def map([head | tail], func), do: [ func.(head) | map(tail, func) ] |
#!/usr/bin/env ruby | |
# Thanks, http://www.schneems.com/blogs/2015-09-30-reverse-rubygems/ | |
require 'net/https' | |
require 'json' | |
require 'uri' | |
gem_name = ENV["GEM_NAME"] | |
def rubygems_get(gem_name: "", endpoint: "") |
#!/bin/bash | |
echo "dir1 dir2 dir3 dir4" |
class GroupJob | |
def initialize(attributes = {}) | |
#do stuff | |
end | |
def perform | |
# do stuff | |
end | |
def success(job) |