Skip to content

Instantly share code, notes, and snippets.


Arjun Venkataswamy arjunvenkat

View GitHub Profile
arjunvenkat /
Last active May 24, 2018 — forked from raghubetina/
CarrierWave Cheatsheet

CarrierWave Cheatsheet

The CarrierWave gem provides us with an easy way to allow file uploads through forms.


In your Gemfile, include

gem 'carrierwave'
arjunvenkat /
Created Apr 11, 2017
App Dev Troubleshooting notes

Week 3



  • Make sure students are running rails s in their app folder, not the app's parent folder
  • Make sure students test output variables after hitting submit, since the forms wont show any work from the controller
arjunvenkat / display_grades.rb
Created May 6, 2016
Parse through JSON grade output
View display_grades.rb
# this file should live in the same directory as the JSON grade output
require 'json'
output = "output.txt","w" )
Dir.foreach('.') do |item|
next if item == '.' || item == '..' || item.include?('json') == false
file =
score = JSON.parse(file)['summary_line']
output.write("#{item} - #{score}\n")
puts "#{item} #{score}"
arjunvenkat /
Last active May 15, 2016
Grading bash script for MBA courses
# edit the project name and any feature specs if they're being copied in
mkdir ${project_name}_grades
cd $project_name
for branch in $(git for-each-ref --format='%(refname)' refs/remotes/); do
echo $short_name
git add -A
arjunvenkat /
Last active Feb 28, 2017
Creating your own branchs

Creating and working with branches in Git

  1. Create a branch with git branch [your_branch_name]
  2. Checkout the branch with git checkout [your_branch_name]
  3. Publish your branch with git push origin [your_branch_name]
  4. Do some work, commit your changes
  5. When your branch is done, checkout master with git checkout master
  6. Pull down any changes from master with git pull
  7. Checkout your branch again and make sure it is up to date with master using git merge master
  8. If there are any conflicts, fix them. If not, you may need to exit the Vim text editor using :wq
arjunvenkat /
Last active Feb 28, 2017
Creating Pull Requests
  1. Fork the repo that you're working on into your own account.
  2. Clone down the fork
  3. Create a new branch in the fork using git branch [branch_name] replacing [branch_name] with a short phrase describing the feature your'e working on
  4. Check the current status of your branches by using git branch. You should see all the branches you have access to. Your current branch will have an * next to it
  5. Check out the new branch using git checkout [branch_name]
  6. Make your changes in the code
  7. Add and commit your changes
  8. Pull down any changes from the original repo:
  9. Add the original repo as an upstream remote with git remote add upstream Make sure to use the actual owner and repository names.
  10. Pull changes into your branch from the upstream remote with git pull upstream master
arjunvenkat /
Created Jul 8, 2015
Rails conceptual review

Use these questions to self-assess your understanding of Rails up to this point:

  1. What is Rails? What problem is it solving for us?
  2. How would you describe terminal?
  3. What is the purpose of the application layout file?
  4. What is the purpose of each of the following parts of a Rails request:
  • the routes file
  • the controller
  • the action
  • the view
arjunvenkat /
Last active Aug 29, 2015
Ruby conceptual review

Define the following terms:

  • integer
  • string
  • array
  • hash
  • loop
  • conditional logic
  • class
  • method
  • instance variable