Skip to content

Instantly share code, notes, and snippets.

View promisepreston's full-sized avatar
💭
Gifted and Result-Oriented

Promise Chukwuenyem promisepreston

💭
Gifted and Result-Oriented
View GitHub Profile

Install Ruby On Rails on Ubuntu 18.04 Bionic Beaver

Table of Contents

  1. Overview
  2. Installing Prerequisites
  3. Installing Ruby with ruby-build
  4. Working with Gems
  5. Installing Rails
  6. Updating rbenv
  7. Uninstalling rbenv

JavaScript Cheat Sheet

Common Commands and Description

Command Description
cd Change directory

Including JavaScript in an HTML Page

Personal Finance with Family

They say don’t mix money and friends. In my case, I have chosen not to mix money and family any more.

I recently found myself in the situation of having to say no when my parents asked me for a €10,000 loan to fund construction work on a beautiful property in Europe that they’ve been turning into a family-run B&B and wedding venue.

This was not the first time they had found themselves in a tight spot. Four years previously, when I was 23, I’d loaned them €10,000 and had a strenuous time getting paid back.

Hit by the 2008 financial crisis, declining revenues from my father’s business and a credit crunch, my parents have been relying more and more on their kids for financial help. But when they asked me recently if I could loan them the lump sum, I declined.

@promisepreston
promisepreston / rails.md
Last active October 22, 2019 20:56
[Rails Post Install MEssage]
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !




@promisepreston
promisepreston / markdown.md
Last active December 9, 2019 15:55
My Personal Cheat Sheet for Markdown

Markdown Cheat Sheet

Headers

H1

H2

H3

H4

H5
H6
require 'jwt'
payload = { data: 'test' }
hmac_secret = 'my$ecretK3y'
token = JWT.encode(payload, hmac_secret, 'HS256')
#eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoidGVzdCJ9.pNIWIL34Jo13LViZAJACzK6Yf0qnvT_BuwOxiMCPE-Y
puts token
#config/routes.rb
namespace :api do
namespace :v1 do
post 'signin', to: 'authentication#create'
end
end
# app/controllers/authentication_controller.rb
class AuthenticationController < ApplicationController
skip_before_action :authenticate_request
def create
command = AuthenticateUser.call(params[:email], params[:password])
if command.success?
render json: { auth_token: command.result }
# app/services/authorize_api_request.rb
class AuthorizeApiRequest
def initialize(headers = {})
@headers = headers
end
def call
{ user: user }