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 lambda_function(event:, context:) | |
puts "Lambda function was called" | |
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
def greeting | |
puts '2' | |
yield | |
end | |
puts '1' | |
greeting { puts '3'} | |
=> 1 | |
=> 2 |
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
resource "aws_elasticsearch_domain" "demo" { | |
domain_name = "demo" | |
elasticsearch_version = "6.2" | |
ebs_options { | |
ebs_enabled = true | |
volume_type = "gp2" | |
volume_size = 10 | |
} |
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
# Converts Heroku configs to a format accepted by .env files | |
class ConvertToEnv | |
File.open('sample_env.txt').each do |line| | |
line = line.sub(':', '=').delete(" \t\r\n") | |
print "#{line}\n" | |
end | |
end | |
ConvertToEnv.new |
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
# To run, cd to this folder and put the following command in the command line | |
# ruby check_difference.rb | |
require 'set' | |
# Returns the user ids for emails that already exist | |
class Difference | |
FILE_ONE = 'all_emails.txt'.freeze | |
FILE_TWO = 'matched_emails.txt'.freeze |
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 'mysql2' | |
require 'csv' | |
# Returns the user ids for emails that already exist | |
class Users | |
CSV_FILENAME = 'emails.csv'.freeze | |
EMAIL_COLUMN_NUMBER = 0 | |
def user_ids | |
ids = [] |
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
# INSERT RECORDS INTO A DB | |
# Use case: To insert millions of records into a local db to test scripts. | |
# Testing scripts that affect millions of records on a remote db is very time consuming. | |
require('mysql2') | |
class Table | |
# @params cur_index [The id to start the insertion at] | |
# @params num_records [Number of records to insert starting at the id above] | |
def insert_records(cur_index, num_records) | |
end_index = cur_index + num_records |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"program": "${workspaceFolder}/node_modules/.bin/lambda-local", | |
"args": [ | |
"-l", |