Skip to content

Instantly share code, notes, and snippets.

View ivanoats's full-sized avatar
💭
🤙 Stoked 🏄‍♂️

Ivan Storck ivanoats

💭
🤙 Stoked 🏄‍♂️
View GitHub Profile

Brother: Hey, I have a question for you… Who is “Roy Fielding”?

ME: Some guy. He's smart.

Brother: Oh? What did he do?

ME: He helped write the first web servers, that sent documents across the Internet… and then he did a ton of research explaining why the web works the way it does. His name is on the specification for the protocol that is used to get pages from servers to your browser.

Brother: How does that work, anyway?

Class Project

1. How has your understanding of Ruby on Rails grown?

2. What features did you implement?

3. How is your code organized?

take us on a tour of MVC in your app

@ivanoats
ivanoats / preferences.json
Last active December 17, 2015 07:09 — forked from brookr/user_preferences.json
Sublime Text Class Settings
{
"font_size": 32.0,
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"save_on_focus_lost": true,
"tab_size": 2,
@ivanoats
ivanoats / n00bfaq.haml
Last active December 16, 2015 13:19 — forked from brookr/gist:5439800
n00b FAQ
%h1 What is Code Fellows?
%p
Web develop jobs abound, and companies struggle to fill engineering roles.
Lots of technically minded folks like you are interested, but the learning
curve is significant.
%p
Code Fellows offers teaching and mentoring services through bootcamps to turn
you and other budding web developers in to professional, emplyable engineers.
%p
We teach industry best practices and tools (that simply aren't covered in

Render and Redirect

The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render in a controller when we want to respond within the current request, and redirect_to when we want to spawn a new request.

Render

The render method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form' or render @post.comments, but here we'll focus on usage within the controller.

:action

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

There are many solutions to most of these questions -- some aren't listed here. Candidates get my respect for knowing esoteric solutions, but I'm looking for developers with similar practices to my own.

" Searches Dash for the word under your cursor in vim, using the keyword
" operator, based on file type. E.g. for JavaScript files, I have it
" configured to search j:term, which immediately brings up the JS doc
" for that keyword. Might need some customisation for your own keywords!
function! SearchDash()
" Some setup
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
# There are 3 ways to access the value of an instance variable:
# @var, the getter method (eg: var), and self.var (where self is the instance itself)
class Car
attr_accessor :color
def shade
"Some kind of #{@color}."
end
def hue
import sublime, sublime_plugin
import os.path, string
VALID_FILENAME_CHARS = "-_.() %s%s%s" % (string.ascii_letters, string.digits, "/:\\")
# { "keys": ["alt+o"], "command": "open_filename_under_cursor" }
# https://gist.github.com/1186126
class OpenFilenameUnderCursor(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]