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 http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Lola's Web Phone!</title> | |
<meta property="og:title" content="Teleprompter!"> |
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 Customer < ApplicationRecord | |
validates_presence_of :first_name, :last_name, :phone | |
validates_uniqueness_of :phone | |
# Implicit validations on presence being done | |
has_secure_password | |
has_secure_password :password_confirmation | |
has_secure_password :recovery_password, validations: false | |
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
create_table "hotels", force: :cascade do |t| | |
t.string "name" | |
t.string "location" | |
t.string "h_type" | |
t.datetime "created_at", precision: 6, null: false | |
t.datetime "updated_at", precision: 6, null: false | |
end | |
create_table "review_details", force: :cascade do |t| | |
t.integer "review_id" |
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
<form action="/create_tweet" method="post"> | |
<label for="content">What's your tweet?</label> | |
<input type="text" name="content"> | |
<button>Tweet</button> | |
</form> |
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 TweetController | |
require 'tweet' | |
get '/new_tweet' do | |
# display html page with form | |
end | |
post '/create_tweet' do | |
content_string = request[:params[:content]] | |
if Tweet.create(content_string) |
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 Tweet | |
require 'my_database' | |
def create(content_string) | |
begin | |
my_database.connect("connection string") | |
my_database.execute("INSERT INTO Tweets(content) VALUES (?)", content_string) | |
my_database.commit | |
my_database.disconnect | |
rescue => e |
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
*, *:before, *:after { | |
box-sizing: border-box; | |
} | |
body { | |
color: darkslategrey; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
background: antiquewhite; |
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
{ | |
"name": "Dev Affirmations", | |
"description": "Affirmations for developers", | |
"repository": "https://github.com/lolaodelola/dev-affirmations", | |
"formation": { | |
"web": { | |
"quantity": 1, | |
"size": "free" | |
} | |
}, |
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
release: rake db:migrate | |
web: bundle exec rails server -p $PORT | |
worker: rake jobs:workoff |
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
namespace :affirmation do | |
task :send_text => :environment do |task, args| | |
count = Affirmation.count | |
random_offset = rand(count) | |
affirmation = Affirmation.offset(random_offset).first | |
Developer.confirmed.each do |dev| | |
SendAffirmationJob.new.deliver(dev, affirmation) | |
SentAffirmation.create!(developer_id: dev.id, affirmation_id: affirmation.id, sent_at: DateTime.now) | |
end | |
end |
NewerOlder