Skip to content

Instantly share code, notes, and snippets.

View cjsim89's full-sized avatar
🏳️‍🌈

Chris Simmons cjsim89

🏳️‍🌈
  • Turing School of Software & Design
  • Columbus, OH
  • 01:16 (UTC -04:00)
View GitHub Profile
@cjsim89
cjsim89 / block_scope_examples.md
Created December 1, 2021 23:17 — forked from megstang/block_scope_examples.md
Block Scope Examples 14-19

Example 14

numbers = [1,2,3]
total = 0
numbers.each do |number|
  total += number
end

p total
@cjsim89
cjsim89 / rails_cheatsheet.md
Created July 25, 2022 15:21 — forked from Scott-Borecki/rails_cheatsheet.md
Rails v5.2 Cheatsheet

Rails v5.2 Cheatsheet

Updated by: Scott Borecki

[![LinkedIn: scott-borecki][linkedin-badge]][LinkedIn] [![Email: scottborecki@gmail.com][gmail-badge]][gmail] [![GitHub: Scott-Borecki][github-follow-badge]][GitHub]

Please reach out if you have any comments or suggestions for updates!

@cjsim89
cjsim89 / Capybara Cheat Sheet.md
Last active August 24, 2022 17:14 — forked from alexbrinkman/Capybara Cheat Sheet.md
A List of Methods for Capybara

Navigating

visit "/projects"
visit post_comments_path(post) # when using `resources` syntax

Clicking links and buttons

click_link "id-of-link" # click_link "#my-id"
click_link "Link Text" # click_link "View Task"
@cjsim89
cjsim89 / heroku_pg_db_reset.md
Created February 16, 2023 17:56 — forked from zulhfreelancer/heroku_pg_db_reset.md
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@cjsim89
cjsim89 / game.md
Created March 27, 2023 15:07
Class vs. Instance Methods M2 - game example
require "pry"
class Game #This game is called "guess what number the computer is thinking of"
   attr_reader :player_name, :computer_choice, :game_over

   def self.start
      game = Game.new
      game.get_players
 game.start_computer
@cjsim89
cjsim89 / rails_7_cheatsheet.md
Last active May 6, 2024 23:20
Rails 7 Cheatsheet

Rails v7.1.2 Cheatsheet

Updated by: Chris Simmons, based on the 5.2 Cheatsheet by Scott Borecki.

Please reach out if you have any comments or suggestions for updates!

Notes About this Cheatsheet

  • This guide uses Rails version v7.1.2. Run rails -v to check your Rails version number.
  • Code snippets in this cheatsheet starting with $:
  • Run from the terminal, usually within your project directory.
@cjsim89
cjsim89 / solutions.md
Created May 12, 2023 17:26
SQL & AR Practice problem solutions

SQL & AR Practice Solutions

These prompts taken from this lesson. Highly suggest trying these on your own FIRST before comparing to these solutions.


  1. Get all songs
@cjsim89
cjsim89 / b3_rails_cheatsheet.md
Last active March 11, 2024 18:39
B3 Rails Cheatsheet

B3 Rails Cheatsheet

Faraday

Getting a basic response:

  response = Faraday.get({url})
@cjsim89
cjsim89 / word_cloud.md
Last active May 9, 2024 14:59
Word Cloud - technical problem

Word Cloud in Ruby

You want to build a word cloud, an infographic where the size of a word corresponds to how often it appears in the body of text. For example, if we turn the Gettysburg Address into a word cloud, it might look like this.

To do this, you'll need data!

Write code that takes a long string and builds its word cloud data into a hash (or JSON object), where the keys are the words and the values are the number of times the words occurred.

Thinking it Through

@cjsim89
cjsim89 / nth_fib.md
Created December 5, 2023 15:35
Nth fibonacci

Return the nth Fibonacci

The Fibonacci series is a numerical series where each item is the sum of the two previous items. It starts off like this:

0, 1, 1, 2, 3, 5, 8, 13, 21 ...

Write a method called fib() that takes an integer n and returns the nth Fibonacci.