Skip to content

Instantly share code, notes, and snippets.

View arjunvenkat's full-sized avatar

Arjun Venkataswamy arjunvenkat

View GitHub Profile
@arjunvenkat
arjunvenkat / rcav.md
Last active July 25, 2016 01:11
the RCAV flow

Our apps are nothing more than a collection of URLs that we decide to allow users to access:

  • mydomain.com/products
  • mydomain.com/photos/193
  • mydomain.com/signin

So remember: everything always starts with a route between a URL we want to support and a Ruby method that will be responsible for generating a response to the user's browser.

In order to support a URL in your app such as http://localhost:3000/signin, there are a lot of dots to connect!

@arjunvenkat
arjunvenkat / git_guide.md
Last active August 29, 2015 14:23
Git Guide

Git Guide

Cloning down a project

In your web browser, navigate to the project page that you want to clone down and copy the clone URL on the middle-right side of the project page. It should look something like https://github.com/tsl-su-15/ruby_logic.git

Then in terminal, navigate to the parent folder that you want to download the project into and and use the following command, replacing [project_url] with your project's URL:

git clone [project_url]
@arjunvenkat
arjunvenkat / gist:1115bc41bf395a162084
Last active January 12, 2024 05:04
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@arjunvenkat
arjunvenkat / devise.md
Last active November 20, 2016 19:47 — forked from raghubetina/devise.md

Authentication and Authorization with Devise

We will be using the [Devise gem][2] to help us get started with authentication (are you who you say you are?) and authorization (are you allowed to do/see this?).

Add sign-in/sign-out

  • Add gem 'devise' to your Gemfile and bundle
  • rails g devise:install

Devise will give you some setup instructions. We don't need to worry about most of them, but we do need to set a root URL. Usually, you will point the root URL to the index action of some important resource in your application: In config/routes.rb:

@arjunvenkat
arjunvenkat / crud_flow_pt1.md
Last active August 29, 2015 14:20
Basic Rails connections

The CRUD flow

Named route helpers

in the index page...

@arjunvenkat
arjunvenkat / gist:089711002874018232b6
Created March 25, 2015 20:12
issues setting up repl.it API

One thing I was confused about was what hostname meant in

ReplitClient(hostname, port, language, token)

I assumed it meant the host of my development/production server. I'm using Rails, which is hosted by default in development at localhost:3000. However, when I tried initializing a new client with:

var token = {

@arjunvenkat
arjunvenkat / gist:6980815
Created October 14, 2013 19:31
Front-end Sublime Preferences
{
"auto_complete_commit_on_tab": true,
"auto_complete_with_fields": true,
"caret_style": "smooth",
"color_scheme": "Packages/Color Scheme - Default/Dawn.tmTheme",
"create_window_at_startup": false,
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
@arjunvenkat
arjunvenkat / gist:6980604
Created October 14, 2013 19:20
sublime package manager installation
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
@arjunvenkat
arjunvenkat / gist:6771204
Last active December 24, 2015 08:29
1-broken-code
<html>
<body>
<p "I like things.">
<h1>My favorite things:<h1>
<ul>
<li><h3>Evernote</h3><img src="http://evernote.com/media/img/products/hero_evernote.png"></li>
<ul>
<h3>Louis C.K.</h2>
@arjunvenkat
arjunvenkat / 0_reuse_code.js
Created September 30, 2013 18:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console