This file contains hidden or 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
package main | |
import ( | |
"bytes" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os/exec" | |
"regexp" |
This file contains hidden or 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
RSpec::Matchers.define :be_identical_docx_file_to do |expected_docx_file| | |
match do |actual_docx_file| | |
expected_file = extract_zip_file(expected_docx_file) | |
actual_file = extract_zip_file(actual_docx_file) | |
expected_file == actual_file | |
end | |
# @param path [String] path to docx file | |
# @return [{String => String}] maps file names to file content | |
private def extract_zip_file(path) |
This file contains hidden or 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 |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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' |