Skip to content

Instantly share code, notes, and snippets.

@raghubetina
raghubetina / web_console_bug.md
Last active January 23, 2017 00:35
Web Console Live Reloading Bug

If, as you’re working on Omnicalc, you are running in to a very confusing issue:

You have made changes to your code in calculations_controller.rb in Atom, (auto)saved it, gone back to Chrome, and refreshed — but nothing happens!

Then read on.

The Problem

As I mentioned in class, this quarter we were trying something new with the interactive Ruby console appearing within Chrome.

@raghubetina
raghubetina / very_best_user_stories.md
Created January 4, 2017 20:22
Very Best User Stories

Very Best User Stories

As a user, I should be able to...

On the Dishes page

  • See the bucket list of dishes
  • See which venue I have bookmarked for each dish, or choose one if I haven't
  • Filter dishes by cuisine
  • Search dishes by name
@raghubetina
raghubetina / windows_fixes.md
Last active December 7, 2016 21:19
First Draft Windows Fixes

Windows Fixes

Unfortunately with the recent releases of Rails 5 and Windows 10, and with RailsInstaller falling behind on updates, we need to take a few steps to fix some annoying incompatibilities once and for all.

First of all, the very first time you bundle for an app, remember to use the verbose command bundle install --without production instead.

SSL Errors

If you are experiencing one of the following issues:

@raghubetina
raghubetina / lti_rails_engine_template.rb
Created July 15, 2016 14:00 — forked from coderberry/lti_rails_engine_template.rb
Rails template for creating LTI apps (as mountable rails engines)
# rails plugin new my_lti_app -T --mountable --dummy-path=spec/test_app -m URL_TO_THIS_RAW_GIST
def ask_wizard(question)
ask "\033[1m\033[30m\033[46m" + "prompt".rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
end
def yes_wizard?(question)
answer = ask_wizard(question + " \033[33m(y/n)\033[0m")
case answer.downcase
when "yes", "y"
@raghubetina
raghubetina / location.html
Created June 8, 2016 15:50
Using HTML5 Location
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Location Example</title>
<!-- jQuery (included in Rails out of the box) -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
</head>
@raghubetina
raghubetina / credentials.md
Last active April 23, 2021 00:48
Hiding your credentials from GitHub

Hiding your credentials from GitHub

In many cases, we need to use secret information in our Ruby; most commonly, API keys and email account passwords.

You should never paste these strings directly into your Ruby code. There are bots that can and will steal your API keys the instant you push your code to a public GitHub repository. Even if you pay for private repositories, it's a good idea to not store secrets in your repo -- you may not want all of your collaborators (interns?) to know, for example, the API keys to your payment processor.

(If you have already pushed an API key to a public repository, you should sign into your API dashboard now and invalidate that old key, and get a new one. Assume that the old one has already been stolen. Reverting your commit will do no good.)

But if our Ruby needs to use these secrets, but we can't keep them in our code, what's the solution? Environment variables. We're going to use a gem called Figaro to make this easy.

@raghubetina
raghubetina / seeding.md
Last active December 8, 2020 15:45
Seeding your database

Seeding your database

It is very helpful to take the time to pre-populate your database with some dummy data before you start working on any features. It's nice to have some data to look at to see whether you are going down the right path.

It's also very helpful to other developers on the project, so they can get started quickly right after they clone.

Here are two ways to create seed data:

Manually + seed_dump

@raghubetina
raghubetina / management_readings.md
Last active December 25, 2017 20:55
A few readings on managing software products

A few readings on managing software products

Workflows

A very powerful Git flow

This is behind a paywall (but there's a trial period). It's very low-level and tactical, so probably hard to understand right now; but you should refer developers that you work with to it, and they should either have a flow similar to this one, or good reasons for using something different:

https://thoughtbot.com/upcase/videos/git-thoughtbot-git-flow

@raghubetina
raghubetina / yelp_stories.md
Last active April 1, 2022 16:22
Yelp User Stories

Yelp User Stories

This is a simplified version of Yelp. Only worry about user stories described here.

As a user, I should be able to...

On the Restaurants page

  • See a list of restaurants
  • Search by name