Skip to content

Instantly share code, notes, and snippets.

View lolaodelola's full-sized avatar

Lola lolaodelola

View GitHub Profile
@lolaodelola
lolaodelola / webphone\index.html
Last active November 22, 2021 19:47
Web Phone index.htmlweb phone index.html file
<!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!">
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
======
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"
<form action="/create_tweet" method="post">
<label for="content">What's your tweet?</label>
<input type="text" name="content">
<button>Tweet</button>
</form>
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)
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
@lolaodelola
lolaodelola / webphone\index.css
Last active February 2, 2021 16:39
web phone index css
*, *:before, *:after {
box-sizing: border-box;
}
body {
color: darkslategrey;
display: flex;
align-items: center;
justify-content: center;
background: antiquewhite;
{
"name": "Dev Affirmations",
"description": "Affirmations for developers",
"repository": "https://github.com/lolaodelola/dev-affirmations",
"formation": {
"web": {
"quantity": 1,
"size": "free"
}
},
release: rake db:migrate
web: bundle exec rails server -p $PORT
worker: rake jobs:workoff
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