Skip to content

Instantly share code, notes, and snippets.

View arjunvenkat's full-sized avatar

Arjun Venkataswamy arjunvenkat

View GitHub Profile
@arjunvenkat
arjunvenkat / carrierwave.md
Last active May 24, 2018 16:11 — forked from raghubetina/carrierwave.md
CarrierWave Cheatsheet

CarrierWave Cheatsheet

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

Installation

In your Gemfile, include

gem 'carrierwave'
@arjunvenkat
arjunvenkat / week3.md
Created April 11, 2017 14:19
App Dev Troubleshooting notes

Week 3

Omnicalc

Setup

  • 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
arjunvenkat / display_grades.rb
Created May 6, 2016 20:15
Parse through JSON grade output
# this file should live in the same directory as the JSON grade output
require 'json'
output = File.open( "output.txt","w" )
Dir.foreach('.') do |item|
next if item == '.' || item == '..' || item.include?('json') == false
file = File.read(item)
score = JSON.parse(file)['summary_line']
output.write("#{item} - #{score}\n")
puts "#{item} #{score}"
@arjunvenkat
arjunvenkat / grade.sh
Last active May 15, 2016 17:43
Grading bash script for MBA courses
# edit the project name and any feature specs if they're being copied in
project_name=photogram_golden_seven
mkdir ${project_name}_grades
cd $project_name
for branch in $(git for-each-ref --format='%(refname)' refs/remotes/); do
short_name=${branch/refs\/remotes\/origin\//""}
echo $short_name
git add -A
@arjunvenkat
arjunvenkat / branches.md
Last active February 28, 2017 05:23
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
arjunvenkat / pull_requests.md
Last active February 28, 2017 05:23
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 https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git. 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
arjunvenkat / rails_questions.md
Created July 8, 2015 14:49
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
arjunvenkat / ruby_questions.md
Last active August 29, 2015 14:24
Ruby conceptual review

Define the following terms:

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