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
(1..50).map { ('a'..'z').to_a[rand(26)] }.join |
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
<template lang="pug"> | |
ul.pagination | |
li.item: a.link.first(@click.prevent="$emit('first-page')") First | |
li.item: a.link.prev(@click.prevent="$emit('prev-page')") Prev | |
li.item(v-for="i in pageTotal") | |
a.link.num( | |
@click.prevent="$emit('set-current-page', i)", | |
:class="i == currentPage ? '-current' : ''" | |
) {{i}} | |
li.item: a.link.next(@click.prevent="$emit('next-page')") Next |
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
RSpec.configure do |config| | |
# Use transactions by default | |
config.before :each do | |
DatabaseRewinder.strategy = :transaction | |
end | |
# Switch to truncation for javascript tests, but *only clean used tables* | |
config.before :each, js: true do | |
DatabaseRewinder.strategy = :truncation, {pre_count: true} | |
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
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
# ver: 0.9.6 | |
# rubocop: v1.38.0 | |
inherit_from: | |
- .rubocop_rails.yml | |
- .rubocop_rspec.yml | |
- .rubocop_todo.yml | |
AllCops: | |
TargetRubyVersion: 3.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
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
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]) |
OlderNewer