Skip to content

Instantly share code, notes, and snippets.

View tomily1's full-sized avatar
🏠
Working from home

Tomilayo Israel tomily1

🏠
Working from home
  • Hamilton, Ontario
  • 12:25 (UTC -04:00)
View GitHub Profile
@tomily1
tomily1 / gist:3efc0c9960aa91192d9f27b7c9d7e40c
Created January 4, 2020 16:01 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@tomily1
tomily1 / isp.rb
Created December 25, 2019 08:29 — forked from jordanhudgens/isp.rb
require 'forwardable'
class Blog
def edit_post
puts "Post edited"
end
def delete_post
puts "Post removed"
end
@tomily1
tomily1 / answers.md
Created December 4, 2019 12:35 — forked from austenito/answers.md
Answers to Ruby Interview Questions

Answers to [Ruby Interview Questions][1]

What is a class?

A text-book answer: classes are a blue-print for constructing computer models for real or virtual objects... boring.

In reality: classes hold data, have methods that interact with that data, and are used to instantiate objects.

Like this.

@tomily1
tomily1 / ruby_readline_issue.md
Created August 22, 2019 15:25 — forked from soultech67/ruby_readline_issue.md
ruby bundler: Sorry, you can't use byebug without Readline

Preamble

On OS/X Sierra, after recently running a brew update I started receiving the error message Sorry, you can't use byebug without Readline when trying to run some rake tasks in my ruby project folder. I observed this in projects and gems that include byebug or pry in their Gemfile or gem.spec. I've found in my googling that many begin encountering this error message after running a brew update but there are other triggering conditions as well.

>> rake aws:show_config
WARN: Unresolved specs during Gem::Specification.reset:
      mime-types (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
 Sorry, you can't use byebug without Readline. To solve this, you need to
require 'cgi'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'authenticated encrypted cookie'
encrypted_cookie_cipher = 'aes-256-gcm'
serializer = ActiveSupport::MessageEncryptor::NullSerializer
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
@tomily1
tomily1 / delete-postmaster.pid.md
Created October 2, 2018 09:11 — forked from zulhfreelancer/delete-postmaster.pid.md
Postgres.app: How to delete postmaster.pid file?
$ cd ~/Library/Application\ Support/Postgres/var-10
$ \rm -f postmaster.pid

OR

$ \rm -f ~/Library/Application\ Support/Postgres/var-10/postmaster.pid
@tomily1
tomily1 / markdown_formatter.rb
Created June 12, 2018 11:10
Markdown Formatter for rake taks
module ActionDispatch
module Routing
class MarkdownFormatter
def initialize
@buffer = []
end
def result
@buffer.join("\n")
end
@tomily1
tomily1 / GradeCalculator.js
Created November 2, 2016 12:47 — forked from andrewjkerr/GradeCalculator.js
A simple grade calculator script written in JavaScript along with the HTML form. The script uses the grading scale from my Marketing class, but you can change it to whatever is needed. Something important to note is that this grade calculator just adds everything up and uses a point scale. --- There's an implementation for my Marketing and Digit…
<script>
function setGrades() {
// Define those variables!
var quiz1 = parseFloat(document.getElementById('quiz1').value);
var quiz2 = parseFloat(document.getElementById('quiz2').value);
var quiz3 = parseFloat(document.getElementById('quiz3').value);
var quiz4 = parseFloat(document.getElementById('quiz4').value);
var quiz5 = parseFloat(document.getElementById('quiz5').value);
var quiz6 = parseFloat(document.getElementById('quiz6').value);
var quiz7 = parseFloat(document.getElementById('quiz7').value);