Skip to content

Instantly share code, notes, and snippets.

View brossetti1's full-sized avatar

Brian Rossetti brossetti1

View GitHub Profile
@brossetti1
brossetti1 / useful gems
Last active August 29, 2015 14:17
list of useful gems
http://awesome-ruby.com/
##################PRODUCTION##################
# pry rails for heroku and dev - https://github.com/rweng/pry-rails
group :development, :test do
gem 'pry-rails'
gem 'pry-byebug'
gem 'pry-remote'
gem 'pry-nav'
gem 'pry-toys'
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
## From Lynda.com course 'RSpec Testing Framework with Ruby'
describe 'Expectation Matchers' do
describe 'equivalence matchers' do
it 'will match loose equality with #eq' do
a = "2 cats"
b = "2 cats"
expect(a).to eq(b)
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
@brossetti1
brossetti1 / psql_cheatsheet.md
Created September 26, 2015 14:20 — forked from sadfuzzy/psql_cheatsheet.md
PostgeSQL Cheatsheet

PostgreSQL Cheatsheet

PSQL main commands

Opening PostgreSQL console:

psql -h <hostname> -U <user> <db> # db is optional

Working with pgsql console

@brossetti1
brossetti1 / README.md
Created September 26, 2015 14:21 — forked from clhenrick/README.md
PostgreSQL & PostGIS cheatsheet (a work in progress)
@brossetti1
brossetti1 / SQL cheatsheet
Created September 26, 2015 17:35 — forked from dannyc5/SQL cheatsheet
SQL cheatsheet
-- SQL Basic Syntax --
--initialize SQLite database w/ command line:
sqlite3 database_name.db
--helpful commands
.help -- list of commands
.tables -- see all tables
.mode column / .header on -- helpful for viewing
@brossetti1
brossetti1 / postgres-cheatsheet.md
Last active July 7, 2017 20:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL - 00000001

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

BASH CHEAT SHEET - 0000001

This file contains short tables of commonly used items in this shell. In most cases the information applies to both the Bourne shell (sh) and the newer bash shell.

Tests (for ifs and loops) are done with [ ] or with the test command.

Checking files:

-r file    # Check if file is readable.