Skip to content

Instantly share code, notes, and snippets.

@GALTdea
GALTdea / index.md
Created April 1, 2017 02:05 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@GALTdea
GALTdea / rails-postgres-backbone-bootstrap-bootswatch
Created April 7, 2017 23:07 — forked from sionc/rails-postgres-backbone-bootstrap-bootswatch
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql
@GALTdea
GALTdea / mysql.database.yml
Created April 8, 2017 00:15 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@GALTdea
GALTdea / rails_generator_cheat_sheet.md
Created August 11, 2019 05:09 — forked from cdesch/rails_generator_cheat_sheet.md
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@GALTdea
GALTdea / vueSetup.md
Created September 28, 2019 00:44 — forked from nerdenough/vueSetup.md
macOS Setup for Vue

macOS setup for Vue

Install macOS :P

Install Homebrew

Open terminal and run the follow command to install the latest version of Homebrew. This will also install the XCode utils if you don't have them already installed.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@GALTdea
GALTdea / stimulus.md
Created July 15, 2020 01:47 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
@GALTdea
GALTdea / index.html
Created July 4, 2021 00:12 — forked from labnol/index.html
A textbox that looks like a notepad! Forms are fun!
<div id="wrapper">
<form id="paper" method="get" action="">
<div id="margin">Title: <input id="title" type="text" name="title"></div>
<textarea placeholder="Enter something funny." id="text" name="text" rows="4" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px; "></textarea>
<br>
<input id="button" type="submit" value="Create">
</form>
</div>
@GALTdea
GALTdea / ds_and_algos.md
Created July 5, 2022 21:04 — forked from iscott/ds_and_algos.md
Intro to Datastructures and Algorithms Cheat Sheet