I hereby claim:
- I am travisofthenorth on github.
- I am travishunter (https://keybase.io/travishunter) on keybase.
- I have a public key whose fingerprint is 3D8C 4969 767F 1A5F E4B9 714C B781 0CC4 B1C2 283F
To claim this, I am signing this object:
[development] # CREATE TABLE test (id integer, name text); | |
[development] # ALTER TABLE test ADD CHECK (name is not null) NOT VALID; | |
[development] # \d test | |
Table "public.test" | |
Column | Type | Modifiers | |
--------+---------+----------- | |
id | integer | | |
name | text | | |
Check constraints: | |
"test_name_check" CHECK (name IS NOT NULL) NOT VALID |
module MorePluckable | |
extend ActiveSupport::Concern | |
class_methods do | |
def pluck_in_batches(*column_names, batch_size: 1000) | |
column_names = column_names.map(&:to_sym) | |
column_names.delete(:id) | |
column_names.unshift(:id) | |
data = [] |
module IndexSearchable | |
extend ActiveSupport::Concern | |
class_methods do | |
def search(options = {}) | |
queries = searchable_terms.map { |term| term_search(term, options[term.to_sym]) } | |
queries << query_search(options[:query]) | |
queries.compact.reduce(:merge) | |
end |
# Upload local file at filepath to <fog_directory>/directory/filename | |
def upload_file(filepath, directory, filename: nil, acl: 'public-read') | |
filename ||= File.basename(filepath) | |
s3 = Aws::S3::Resource.new(region: region) | |
obj = s3.bucket(bucket).object("#{directory}/#{filename}") | |
obj.upload_file(filepath, acl: acl) | |
end | |
# Download file from <fog_directory>/remote_filepath to local filepath |
class Array | |
def contains_sum?(n) | |
return false if n.nil? | |
low = 0 | |
high = 0 | |
sum = first | |
while sum != n && low < size | |
if sum < n || low == high | |
return false if high == size - 1 |
class Matrix | |
Coordinate = Struct.new(:x, :y) | |
def initialize(grid) | |
@grid = grid | |
end | |
def binary_search(n) | |
row = find_row(n, 0, grid.count - 1) | |
return nil unless row |
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
find spec -iname "*spec.rb" -exec sed -i.bak 's/create/build/g' {} \; | |
find spec -iname "*spec.rb" -print0 | while IFS= read -r -d $'\0' spec; do | |
spring rspec $spec --fail-fast | |
if [[ $? -gt 0 ]]; then | |
echo "$spec did not pass" | |
else | |
echo "$spec passed!!!" |
module JailedConsole | |
extend ActiveSupport::Concern | |
included do | |
require 'colorize' | |
def sandbox_console | |
require 'webmock' | |
require 'sidekiq/testing' if defined?(Sidekiq) | |
end |