This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "http://rubygems.org" | |
gem 'benchmark-ips' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pagination | |
extend ActiveSupport::Concern | |
included do | |
contract do | |
property :limit, validates: { numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 50 } } | |
property :offset, validates: { numericality: { greater_than_or_equal_to: 0 } } | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, we'll need a bunch of helpers -- `m()` for minutes | |
# and `s()` for seconds: | |
s = (sec) -> sec * 1000 | |
m = (min) -> min * s(60) | |
# Humanizer.between(from, to, includeSeconds) | |
# | |
# Returns the approximate distance in time between | |
# two given objects, which can either be `Date` or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'mechanize' | |
gem 'ruby-stemmer' | |
gem 'sequel' | |
gem 'sqlite3' | |
gem 'active_support' | |
gem 'i18n' | |
gem 'rake' | |
gem 'hirb-unicode' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Project-specific .irbrc | |
if Dir.pwd != File.expand_path("~") | |
local_irbrc = File.expand_path '.irbrc' | |
if File.exist? local_irbrc | |
puts "Loading #{local_irbrc}" | |
load local_irbrc | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unbind(key: String, pagination: Pagination): String = { | |
val limit: Option[String] = pagination.limit.map(key + "[limit]=" + _) | |
val offset: Option[String] = pagination.offset.map(key + "[offset]=" + _) | |
return Seq(limit, offset).filter(_.isDefined).map(_.get).mkString("&") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<item> | |
<name>Editor mode</name> | |
<appendix>Navigate:</appendix> | |
<appendix>* Cmd+I to UP</appendix> | |
<appendix>* Cmd+K to DOWN</appendix> | |
<appendix>* Cmd+J to LEFT</appendix> | |
<appendix>* Cmd+L to RIGHT</appendix> | |
<appendix>* Cmd+U to Option+LEFT</appendix> | |
<appendix>* Cmd+O to Option+RIGHT</appendix> | |
<appendix></appendix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require ['fileA', 'fileB'], (A, B) -> | |
describe "An example", -> | |
it "depends on A and B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract struct A | |
def self.build(value) | |
if value.nil? | |
B.new | |
else | |
C.new | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'dry/validation' | |
require 'dry/core/class_attributes' | |
require 'active_action/action/params' | |
module ActiveAction | |
# This module provides validation logic for controller actions. | |
# @example | |
# class CreateUserAction |
OlderNewer