Skip to content

Instantly share code, notes, and snippets.

View EfeAgare's full-sized avatar
🎯
Focusing

Efe Agare EfeAgare

🎯
Focusing
View GitHub Profile

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@EfeAgare
EfeAgare / rm_mysql.md
Created December 16, 2019 13:07 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@EfeAgare
EfeAgare / postgres-brew.md
Created February 21, 2020 17:22 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@EfeAgare
EfeAgare / postgres-brew.md
Created February 21, 2020 17:22 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@EfeAgare
EfeAgare / rspec_helper_example.md
Created April 20, 2020 00:06 — forked from HeroicEric/rspec_helper_example.md
An example of how to create a RSpec test helper

RSpec Helper Example

Here's an example of a rspec test helper that will let you sign in as a given user.

Create spec/support/helpers/authentication.rb with the following:

module Helpers
  module Authentication
    def sign_in_as(user)
@EfeAgare
EfeAgare / Capybara.md
Created April 20, 2020 00:20 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above

Keybase proof

I hereby claim:

  • I am efeagare on github.
  • I am efeagare (https://keybase.io/efeagare) on keybase.
  • I have a public key ASBDBPKjn4DxsBEc5bap974LCnzxpPSCN_TMEeX8qUy1awo

To claim this, I am signing this object:

@EfeAgare
EfeAgare / attachment.rb
Created October 13, 2020 19:07 — forked from madwork/attachment.rb
Polymorphic attachments with CarrierWave and nested_attributes
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment
@EfeAgare
EfeAgare / !README.MD
Created December 18, 2020 11:12 — forked from davideluque/!README.MD
Sign in with Apple in Ruby on Rails using apple_id gem.

Implementation of the Sign in with Apple service in Ruby on Rails. This implementation is convenient for Ruby on Rails APIs as it does not use views.

This implementation does:

  • Verify the user's identity token with apple servers to confirm that the token is not expired and ensure it has not been tampered with or replayed to the app.
  • Log in the user, register the user or connect the user's apple account to the user's existing account.

Parameters

  • code: Apple's authorizationCode after sign in. Example: c49a75458b1e74b9f8e866f5a93b1689a.0.nrtuy. ...
@EfeAgare
EfeAgare / strip HTML tags
Created January 17, 2021 19:38 — forked from awesome/strip HTML tags
ruby strip HTML tags
# copied from (thanks!): http://codesnippets.joyent.com/posts/show/615
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>