Skip to content

Instantly share code, notes, and snippets.

@osazemeu
osazemeu / 20210520175831_create_albums.rb
Created February 9, 2024 22:07
Qualified Andela Ruby
class CreateAlbums < ActiveRecord::Migration[6.1]
def change
create_table "albums", force: :cascade do |t|
t.string "title"
t.string "performer"
t.integer "cost"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "last_purchased_at"
t.integer "last_purchased_by"

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@osazemeu
osazemeu / readme.md
Created February 15, 2022 11:05 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@osazemeu
osazemeu / week_one.md
Last active February 21, 2022 11:19
Exercises

Exercises

Variables and Print

Q1a) Ask user information, for ex: name, department, college etc and display them using print function

# Sample of how program might ask user input and display output afterwards
$ ./usr_ip.rb 
Please provide the following details
@osazemeu
osazemeu / sha256-hmac.md
Created July 26, 2021 21:52 — forked from jasny/sha256-hmac.md
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@osazemeu
osazemeu / ubuntu-post-install.sh
Created May 16, 2021 18:42 — forked from rougeth/ubuntu-post-install.sh
A post-installation bash script for Ubuntu (13.10)
#!/bin/bash
#
# Ubuntu post-install script
#
# Author:
# Marco Rougeth <marco@rougeth.com>
#
# Description:
# A post-installation bash script for Ubuntu (13.10)
#
@osazemeu
osazemeu / rails-elasticbean.txt
Created June 7, 2020 11:21 — forked from mankind/rails-elasticbean.txt
Deploying a simple Rails application with AWS Elastic Beanstalk
Deploying a simple Rails application with AWS Elastic Beanstalk by Julien SIMON, Principal Technical Evangelist @ Amazon Web Services
18/02/2016
http://www.slideshare.net/JulienSIMON5/deploying-a-simple-rails-application-with-aws-elastic-beanstalk
1. . Create a Git repository with AWS CodeCommit
$ aws codecommit create-repository --repository-name blog --region us-east-1 --repository-description "ElasticBeanstalk demo"
$ git clone ssh://git-codecommit.us- east-1.amazonaws.com/v1/repos/blog
2. Create a new Rails application
@osazemeu
osazemeu / vscode.sh
Last active September 7, 2020 21:30
My Preferred VS Code Plugins
code --install-extension alefragnani.Bookmarks
code --install-extension alexkrechik.cucumberautocomplete
code --install-extension Angular.ng-template
code --install-extension BitBelt.converttoasciiart
code --install-extension buenon.scratchpads
code --install-extension bung87.vscode-gemfile
code --install-extension castwide.solargraph
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension codezombiech.gitignore
@osazemeu
osazemeu / gist:4bdf00813d6bc1b31116150231cb69f2
Last active December 29, 2019 02:21 — forked from jkubacki/gist:e2dd904bd648b0bd4554
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@osazemeu
osazemeu / custom_array.rb
Last active June 20, 2019 20:05
This gist illustrates the flatten array method from ground up. :)
# This solution attempts to handle flattening of nested arrays gracefully
class CustomArray
def flatten(array)
raise 'input is not an array' unless array?(array)
return [] if array.empty?
recursive_flatten(array)
end
private