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 make_string(length, type = :alphabet, random: false) | |
char_set = nil | |
case type | |
when :alphabet | |
char_set = ('a'..'z').to_a | |
when :zenkaku | |
char_set = ('あ'..'ん').to_a | |
when :hankaku | |
char_set = ('ア'..'ン').to_a | |
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
require 'thread' | |
THREAD_NUM = 4 | |
list = ['*', | |
'_*', | |
'__*', | |
'___*', | |
'____*', | |
'_____*', |
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 WaitForAjax | |
def wait_for_ajax | |
Timeout.timeout(Capybara.default_wait_time) do | |
loop until finished_all_ajax_requests? | |
end | |
end | |
def finished_all_ajax_requests? | |
page.evaluate_script('jQuery.active').zero? | |
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
namespace :notes do | |
desc "Enumerate all annotations" | |
task 'all' do | |
ENV['SOURCE_ANNOTATION_DIRECTORIES'] ||= 'spec' | |
SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO|HACK", tag: true | |
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
box: ruby:2.3.0 | |
services: | |
- postgres | |
build: | |
steps: | |
- script: | |
name: install Nodejs | |
code: | | |
sudo apt-get update -y | |
sudo apt-get install nodejs npm -y |
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
javascript: | |
flash = #{raw flash.to_json}; | |
coffee: | |
$ -> | |
$.each flash, (index, message) -> | |
toastr[message[0]]('', message[1]) |
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
# config/initializers/annotations.rb | |
Rails.application.config.annotations.register_extensions('scss') { |annotation| %r{//\s*(#{annotation}):?\s*(.*?)$} } | |
Rails.application.config.annotations.register_extensions('slim') { |annotation| %r{/\s*(#{annotation}):?\s*(.*?)$} } | |
Rails.application.config.annotations.register_extensions('coffee') { |annotation| /#\s*(#{annotation}):?\s*(.*?)$/ } |
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
# cat config/initializers/routes.rb | |
Rails.application.config.paths["config/routes.rb"].concat Dir[Rails.root.join("config/routes/**/*.rb")] |
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
begin | |
require 'coffeelint' unless defined?(Coffeelint) | |
desc "lint application javascript" | |
task :coffeelint do | |
config_file = ENV['config_file'] || '.coffeelint.json' | |
directories = ENV['directories'].try(:split, ',') || ['app/assets/javascripts', 'spec/javascripts'] | |
failures = 0 | |
directories.each do |dir| |
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
begin | |
require 'slim_lint/rake_task' | |
SlimLint::RakeTask.new do |t| | |
t.config = '.slim_lint.yml' | |
t.files = %w(app/views/**/*.slim) | |
t.quiet = false | |
end | |
rescue LoadError | |
puts 'slim_lint load error' |
OlderNewer