Skip to content

Instantly share code, notes, and snippets.

@elikem
elikem / rails_model_template.rb
Created April 14, 2023 22:59 — forked from metalelf0/rails_model_template.rb
A rails model template to better organize your code
# provided by https://www.zmwolski.com/Organizing-Ruby-on-Rails-Models
class User < ActiveRecord::Base
# == Constants ============================================================
# == Attributes ===========================================================
# == Extensions ===========================================================
@elikem
elikem / vim-shortcuts.md
Created January 18, 2023 13:52 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@elikem
elikem / SpaceVim.md
Created August 19, 2022 03:35 — forked from bespokoid/SpaceVim.md
SpaceVim cheatsheet #tools
@elikem
elikem / git_cheat-sheet.md
Created September 12, 2020 22:25 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
@elikem
elikem / RAILS_CHEATSHEET.md
Created June 3, 2020 22:06 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@elikem
elikem / RAILS_CHEATSHEET.md
Created June 3, 2020 22:06 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@elikem
elikem / git_examples.sh
Created October 8, 2019 16:06
99% of the Git commands you'll need at work, demonstrated in a single script
#!/bin/bash
##########
# contents
##########
# contents
# notes
# script setup
# git config files
@elikem
elikem / friendly_urls.markdown
Created July 2, 2019 04:18 — forked from cdmwebs/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.