View simplecov_merge.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
require 'json' | |
require 'simplecov' | |
Dir["coverage/.resultset-*.json"] | |
.map(&File.method(:read)) | |
.map(&JSON.method(:parse)) | |
.map { |json| SimpleCov::Result.new(json['RSpec']['coverage']) } | |
.then { |results| SimpleCov::ResultMerger.merge_results(*results) } | |
.then { |merged_result| merged_result.covered_percent < 100 } |
View index.html
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
<html> | |
<head> | |
<meta charset="utf-8"/> | |
</head> | |
<body> | |
<style> | |
body { | |
background-color: #251A1A; | |
font-family: sans-serif; | |
} |
View slack_bot.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
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require_relative '../config/boot' | |
require_relative '../config/environment' | |
require 'slack' | |
Slack.configure do |config| | |
config.token = Rails.application.secrets.slack_bot[:token] | |
end |
View autocomplete_input.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
# app/admin/components/autocomplete_input.rb | |
module Components | |
class AutocompleteInput < Arbre::Component | |
builder_method :autocomplete_input | |
def tag_name | |
'li' | |
end | |
def default_class_name |
View tracker.coffee
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
class Tracker | |
constructor: -> | |
@success = false | |
@pageLeftTracked = false | |
trackFormChoices: -> | |
$formInputs = $('form section input') | |
$formInputs.each (index, input) => | |
$(input).change => |
View strategies.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
# importing method | |
def import_items(source) | |
if SECTION_SOURCES.include? source.name | |
Strategies::SectionStrategy.items(@repository, source.id).each(&method(:import_item)) | |
else | |
Strategies::ItemsStrategy.items(@repository, source.id).each(&method(:import_item)) | |
end | |
end | |
# strategies |
View banhammer.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
# Gemfile | |
gem 'rack-attack' | |
# config/application.rb | |
config.middleware.use Rack::Attack | |
# config/initializers/rack_attack.rb | |
BANNED_DOMAINS = %w( | |
google-liar.ru |
View povray.vim
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
" compile POVRay script being currently edited, clear output and open the resulting .png ONLY when povray compilation succeeds. | |
command Povray !povray % && clear && feh %<.png | |
" delete the generated .png when exiting from .pov file of the same name. | |
autocmd BufWinLeave *.pov :!rm %<.png |