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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Capybara race condition with `text` matcher</title> | |
<script type="text/javascript" src="/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { |
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 'spec_helper' | |
describe 'update distribution list', ldap: true do | |
it 'updates data in LDAP' do | |
n = 4 | |
# Do add 4 DL entries | |
expect(TEST_LDAP_SERVER.store.count).to eql n |
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
ActiveAdmin.register Category do | |
index do | |
reorderable_column(self) | |
column :name | |
end | |
controller do | |
private |
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
<!-- Global site tag (gtag.js) - Google Analytics --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag() { | |
dataLayer.push(arguments); | |
} | |
document.addEventListener('turbolinks:load', function (event) { | |
if (typeof gtag === 'function') { |
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
CSV.open("tmp/records.csv", "wb") do |csv| | |
csv << ConnectRequest.attribute_names | |
ConnectRequest.where('created_at > ?', 2.day.ago).each do |record| | |
csv << record.attributes.values | |
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
require 'net/http' | |
# The simplified version of logger can be copypasted into Rails initializer. | |
module HttpLogger | |
def request(req, body = nil, &block) | |
start_time = Time.current | |
super.tap do |resp| | |
log_request(http: self, request: req, response: resp, start_time: start_time) rescue nil | |
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
module TimeUtils | |
def self.wait_for(title: '', max_wait_time: 5, wait_interval: 0.1, | |
raise_timeout_error: false, | |
debug: false, | |
&block) | |
puts "Waiting for #{title}" if debug | |
waiting_time = 0 |
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 Receipt | |
def initialize(user:) | |
@user = user | |
end | |
def payments | |
# Imagine you get payments like Payment.where(user: @user). So payments are actually retrieved, `get`. | |
[ | |
{name: 'Shoes', price: 5.2 }, | |
{name: 'Book', price: 3.5 } |
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
git checkout master2 | |
# delete local master | |
git branch -D master | |
# rename master2 to master | |
git branch -m master2 master | |
# Push master with force option to overwrite existing remote branch. | |
git push --set-upstream -f origin master |
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 A | |
def foo | |
:a | |
end | |
end | |
module B | |
def foo | |
:b | |
end |