Skip to content

Instantly share code, notes, and snippets.

@stevenyap
stevenyap / Start New Project.md
Last active March 1, 2018 02:14
Describes best practices in starting a ROR project

These are steps to setup a new project in ROR.
You must configure and install your Gems individually instead of copying the Gemfile from a previous project.

Refer to Heroku setup if you want to push your project to Heroku.

Setup directory

# Create directory in ~/workspace
mkdir ./testproject
cd ./testproject
@stevenyap
stevenyap / Github Flavored Markdown.md
Last active March 28, 2024 17:42
Github Flavored Markdown cheatsheet

Github Flavored Markdown (GFMD) is based on Markdown Syntax Guide with some overwriting as described at Github Flavored Markdown

Text Writing

It is easy to write in GFMD. Just write simply like text and use the below simple "tagging" to mark the text and you are good to go!

To specify a paragraph, leave 2 spaces at the end of the line

Headings

@stevenyap
stevenyap / Development Philosophies.md
Created October 18, 2013 08:55
A list of ROR development philosophies

Test driven development

Write failing test case first (RED)

  • Write test cases strictly to expose core functions and errors
  • Your test cases guard your app from future changes
  • Test cases also tells how your app works
  • Think about how other codes will impact your code
  • Test cases test on the coding's behavior, not implementation.

Write the simplest code to satisfy test case (GREEN)

@stevenyap
stevenyap / XP Workflow.md
Last active December 25, 2015 20:58
XP Workflow

Inception

  • First meeting with client to tie down on stories

Daily standup (daily)

  • what have you done yesterday?
  • what will you do today?
  • Any blockage?
  • Any other updates?

Story acceptance meeting (daily or whenever a story is completed)

@stevenyap
stevenyap / Gem Listing.md
Last active December 25, 2015 20:58
Listing of useful gems (please refer to individual gem gist for more detailed information)

Note

  • Always check the github for instructions to install + configure
  • Refer to https://www.ruby-toolbox.com/ for gem discovery
  • Always install gem one-by-one
gem "haml-rails" # this is for HAML HTML output

gem "bootstrap-sass" # this is for bootstrap inclusion + css coding (CSS files go into /assets/stylesheets/)
@stevenyap
stevenyap / Rake Database.md
Last active April 13, 2023 09:42
List of rake commands to manage database

Create database

rake db:create

Create database table

This will creates a migration file in /db/migrate without table definition.

rails g migration create_<TABLE>
@stevenyap
stevenyap / Rails Command Line.md
Last active December 25, 2015 20:59
List of rails command lines

Starts the rails server

rails s

View a running list of the development log

tail -f log/development.log
@stevenyap
stevenyap / Rubymine Shortcuts.md
Last active December 25, 2015 20:59
List of Rubymine shortcuts

CMD + click on function name # go to the function definition directly
Shift + F6 # changes all variable on the page
Alt + Enter # changes a do block into {} block and vice-versa
CMD + Shift + 8 # change to column editing and vice-versa (good to edit a column)

Rubymine can't load folders

  • This may happens when you switch branches, etc that causes Rubymine to show this error
  • Go to "File > Invalidates caches" and click OK and restart your Rubymine
  • You can also try git gc to clear your git caches
@stevenyap
stevenyap / Rake Commands.md
Last active December 25, 2015 20:59
List of useful rake commands
rake notes # shows TODO list

rake routes # See routing rules

rake -T # Shows all rake tasks including your custom ones

rake stats # see all the stats of your code (FUN!)
@stevenyap
stevenyap / Rails Routing.md
Created October 18, 2013 13:07
Cheatsheet on Rails Routing Rules

Nested resources

resources :cruises do
  resources :categories
end

Restricting routing to resource