All notable changes to this API will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Renamed
tag
toamenity
where applicable. Expected date of removal: 2021-06-30GET /v3/tags
def gregorian_date?(date) | |
return false if date.nil? | |
(date.month == 2 and date.day == 29) ? Date.gregorian_leap?(date.year) : true | |
end |
# Example | |
assert_differences 'Initiative.count' => 1, 'Role.count' => -1, 'Phase.count' => 0 do | |
@initiative.to_template! | |
end | |
def assert_differences(collection = {}, &block) | |
yield and return if collection.empty? | |
collection.shift.tap do |diff| | |
assert_differences(collection){ assert_difference(diff.first, diff.last, &block) } |
# Rails3 way to redirect non-www domain to www domain | |
# Single domain redirect | |
'example.com'.tap do |host| | |
constraints(:host => host) do | |
match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(host, "www.#{host}") } | |
end | |
end | |
Tracking and contributing to the trunk of a Subversion-managed project: | |
# Clone a repo (like git clone): | |
git svn clone http://svn.example.com/project/trunk | |
# Enter the newly cloned directory: | |
cd trunk | |
# You should be on master branch, double-check with 'git branch' | |
git branch | |
# Do some work and commit locally to git: | |
git commit ... |
#!/usr/bin/env ruby | |
require 'yaml' | |
require 'pg' | |
# Usage | |
if ARGV.size == 0 | |
puts "Usage: script/dj_client WorkerName arg1 arg2" | |
exit(0) | |
end |
class @BoundedEventBuffer | |
constructor: ( options = {} ) -> | |
@buffer = [] | |
@processConditionMet = false | |
@processing = false | |
{ @name, @bufferSize, @processWhen, @interval } = options | |
@name = options.name ? 'AnonymousEventBuffer' | |
@bufferSize = options.bufferSize ? 100 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch | |
git_custom_status() { | |
local cb=$(current_branch) | |
if [ -n "$cb" ]; then | |
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
# frozen_string_literal: true | |
module BookingExperts | |
class Client | |
class Error < StandardError; end | |
class InvalidSignature < Error; end | |
attr_accessor :token_store | |
def initialize(token_store = nil) |
All notable changes to this API will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
tag
to amenity
where applicable. Expected date of removal: 2021-06-30
GET /v3/tags
## CREATE EXAMPLE ## | |
# folder: app/actions/posts | |
class Actions::Posts::CreatePost | |
include Actions::Posts::PostAction # In this scenario there is overlap between create & update, so introduce a concern | |
def perform!(post, author_scope:) | |
validate_action!(post, author_scope: author_scope) | |
post.assign_attributes(attributes) | |
post.save! |