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
  • 11:19 (UTC -05:00)
View GitHub Profile
@cjsim89
cjsim89 / openers_closers.md
Created December 6, 2023 18:05
Openers/closers technical interview question

Validating Openers/Closers

You're working with an intern that keeps coming to you with some code that won't run because the braces, brackets, and parentheses are off. To save you both some time, you decide to write a braces/brackets/parentheses validator.

Let's say that:

  • (, {, and [ are called "openers", and
  • ), }, and ] are called "closers".

Write an efficient method that tells us whether or not an input string's openers and closers are properly nested.

@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.

@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 / 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 / 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 / rails_7_cheatsheet.md
Last active October 2, 2024 21:47
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 / 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 / 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 / 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 / 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: [email protected]][gmail-badge]][gmail] [![GitHub: Scott-Borecki][github-follow-badge]][GitHub]

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