Skip to content

Instantly share code, notes, and snippets.

validation(with: {form: true}) do
configure do
def non_destroyed_items?(value)
form.items.detect {|i| !i._destroy}
end
def item_sum?(value)
isum = form.items.reduce(0) do |sum, item|
sum += item._destroy ? 0 : item.amount
end
@dnd
dnd / yml
Created August 7, 2017 21:33
migrate-db:
salt.state:
- tgt: {{salt.saltutil.runner('app.db_minion', app='board', environment=deploy_env)}}
- sls:
- app.board.db
- pillar:
board_deploy_revision: {{revision}}
- require:
- salt: refresh_pillar
- salt: sync_all
@dnd
dnd / commit.md
Created September 11, 2017 01:53 — forked from abravalheri/commit.md
RFC: Git Commit Message Guidelines

Commit Message Guidelines

In the last few yers, the number of programmers concerned about writting structured commit messages had dramatically grown. As exposed by Tim Pope in article readable commit messages are easy to follow when looking through the project history. Moreover the AngularJS contributing guides introduced conventions that can be used by automation tools to automatically generate useful documentation, or by developpers during debbuging process.

This document borrow some concepts, conventions and even text mainly from these two sources, extending them in order to provide a sensible guideline for writing commit messages.

class Mutations::SigninUser < GraphQL::Function
SigninPayload = GraphQL::ObjectType.define do
name 'SigninPayload'
field :token, types.String, description: 'A JWT representing the authenticated user'
field :user, Types::User, description: 'The authenticated user
end
type SigninPayload
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (3,'bob smith','2017-11-26');
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (4,'bob jones','2017-11-26');
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (5,'bob ames','2017-11-26');
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (6,'adam','2017-11-27');
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (7,'larry','2017-11-27');
INSERT INTO `new_table` (`id`,`name`,`created_at`) VALUES (8,'hank','2017-11-29');