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
const maskDate = value => { | |
let v = value.replace(/\D/g,'').slice(0, 10); | |
if (v.length >= 5) { | |
return `${v.slice(0,2)}/${v.slice(2,4)}/${v.slice(4)}`; | |
} | |
else if (v.length >= 3) { | |
return `${v.slice(0,2)}/${v.slice(2)}`; | |
} | |
return v | |
} |
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
# user.rb file | |
class User | |
attr_reader :admin | |
def initialize(admin: false) | |
@admin = admin | |
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
FROM ruby:2.4.2-alpine3.4 | |
MAINTAINER Lucas Charles (theoretick) <[email protected]> | |
EXPOSE 8080 | |
ENV APP_PATH /srv/app | |
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.4/main" >> /etc/apk/repositories && \ | |
echo "http://dl-4.alpinelinux.org/alpine/v3.4/community" >> /etc/apk/repositories |
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
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
require 'csv' | |
headings = %w(id expires bytes key) | |
rows = [] |
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
# load into test setup after `require 'capybara/rails'` | |
# some sources for below flags and profile settings | |
# https://stackoverflow.com/questions/43143014/chrome-is-being-controlled-by-automated-test-software/43145088 | |
# https://sqa.stackexchange.com/questions/26051/chrome-driver-2-28-chrome-is-being-controlled-by-automated-test-software-notif | |
# http://stackoverflow.com/questions/12211781/how-to-maximize-window-in-chrome-using-webdriver-python | |
# update sources for new Options object | |
# https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings | |
# https://github.com/teamcapybara/capybara/blob/master/lib/capybara/selenium/driver.rb | |
begin |
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
resource "aws_rds_cluster" "default" { | |
cluster_identifier = "${var.service}-${var.name}-${var.env}" | |
master_username = "${var.username}" | |
master_password = "${var.password}" | |
backup_retention_period = 5 | |
preferred_backup_window = "19:30-20:00" | |
preferred_maintenance_window = "wed:20:15-wed:20:45" | |
port = 3306 | |
vpc_security_group_ids = ["${var.security_group_ids}"] | |
db_subnet_group_name = "${var.subnet_group_name}" |
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 'sidekiq/api' | |
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear |
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 AnyFixture | |
INSERT_RXP = /^INSERT INTO ([\S]+)/ | |
class Cache | |
attr_reader :store | |
delegate :clear, to: :store | |
def initialize | |
@store = {} |
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
{ | |
"chromeOptions": { | |
"prefs": { | |
"credentials_enable_service": false, | |
"profile.password_manager_enabled": false | |
} | |
} | |
} |
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
resource "aws_launch_configuration" "test" { | |
name = "test" | |
image_id = "${var.ami}" | |
instance_type = "t2.micro" | |
associate_public_ip_address = true | |
security_groups = ["${aws_security_group.internal.id}"] | |
} | |
resource "aws_autoscaling_group" "test" { | |
name = "test" |