Skip to content

Instantly share code, notes, and snippets.

View evantravers's full-sized avatar
💭
Fooling around in elixir…

Evan Travers evantravers

💭
Fooling around in elixir…
View GitHub Profile
# requires the geopy library from this site:
# https://code.google.com/p/geopy/
# only runs under python 2.6 because of geopy
import sys
import re
from geopy import geocoders
for file in sys.argv[1:]:
print("working on " + file + "...")
FILE = open(file)
Gotospace::Application.routes.draw do
devise_for :users do
resources :lists
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
<h1>Listing lists</h1>
<table>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
class ListsController < ApplicationController
before_filter :authenticate_user!
# GET /lists
# GET /lists.json
def index
@lists = current_user.lists
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
Gotospace::Application.routes.draw do
devise_for :users do
resources :lists do
resources :todos
end
end
# The priority is based upon order of creation:
# first created -> highest priority.
Gotospace::Application.routes.draw do
devise_for :users
resources :lists do
resources :todos
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
<p id="notice"><%= notice %></p>
<p>
<%= @list.name %>:
</p>
<ul>
<% @todos.each do |todo| %>
<li><%= todo.name %></li>
<% end %>
</ul>
class TodosController < ApplicationController
# GET /todos
# GET /todos.json
def index
@todos = current_user.lists.find(params[:list_id]).todos
respond_to do |format|
format.html # index.html.erb
format.json { render json: @todos }
end
<%= form_for(@todo) do |f| %>
<% if @todo.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@todo.errors.count, "error") %> prohibited this todo from being saved:</h2>
<ul>
<% @todo.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<h1>New todo</h1>
<%= render 'form' %>
<%= link_to 'Back', todos_path %>