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
Aws.config.update({ | |
region: "us-west-1", | |
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']), | |
}) | |
S3_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET']) |
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
heroku config:set AWS_ACCESS_ID=YOUR_ACCESS_ID | |
heroku config:set AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY | |
heroku config:set S3_BUCKET=YOUR_BUCKET_NAME |
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
heroku config:set AWS_ACCESS_ID=YOUR_ACCESS_ID | |
heroku config:set AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY | |
heroku config:set S3_BUCKET=YOUR_BUCKET_NAME |
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
config.before_configuration do | |
env_file = File.join(Rails.root, 'config', 'local_env.yml') | |
YAML.load(File.open(env_file)).each do |key, value| | |
ENV[key.to_s] = value | |
end if File.exists?(env_file) | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>http://localhost:3000</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedMethod>HEAD</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedHeader>*</AllowedHeader> | |
</CORSRule> |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<ul id="root"> |
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
Benchmark.bm(10000000) do |x| | |
x.report {puts transposer('gngngnnggnngggnnngngngngngngngngngngngngngngngngngngngngngngngngngngngngngngnnnnnnnnnnnnnnggggggggggggggggggggggggggggggggggggggggggngngngngnnnnnnnnnngng')} | |
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
if string[ i ] != 'g' && string[i] != 'n' && string[i] | |
result += string[ i ] | |
next | |
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
if string[i] == 'g' | |
deque.pushBack(string[ i ]) | |
next | |
elsif string[i] == 'n' | |
deque.pushFront(string[ i ]) | |
next | |
else | |
deque.empty_into(result) unless deque.empty? | |
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 transposer(string) | |
#initialize the deque | |
deque = Deque.new | |
#initialize the result variable | |
result = '' | |
#Correctly define our loop | |
for i in 0..string.length do | |
#The rest of our code goes in here | |
end |