Skip to content

Instantly share code, notes, and snippets.

@andrekibbe
andrekibbe / boiler
Created May 31, 2015 15:56
JavaScript boilerplate
(function () {
'use strict';
}());
@andrekibbe
andrekibbe / gist:42cb081c9c07a14d3b22
Created February 16, 2015 00:15
Resource request cycle for new.html.erb
Started POST "/users" for ::1 at 2015-02-15 16:08:06 -0800
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"kovkapHotITJmc67AYqrGFrcC4adcA3uCeL9Y+0hbB0RckGhR883KQNmsb9F8gSkkXSiXJ875A5zx8YxNxP/zA==", "user"=>{"name"=>"Andre Kibbe", "address"=>"1244 Euclid St. # 6", "city"=>"Santa Monica", "postal_code"=>"90404", "email"=>"akibbe02@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
Unpermitted parameters: name, address, city, postal_code
(0.1ms) begin transaction
User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'akibbe02@gmail.com' LIMIT 1
(0.1ms) rollback transaction
Rendered devise/shared/_links.html.erb (2.5ms)
Rendered devise/registrations/new.html.erb within layouts/application (16.0ms)
Category Load (0.2ms) SELECT "categories".* FROM "categories"
@andrekibbe
andrekibbe / gist:6c30692efb23d348aab2
Created February 14, 2015 02:35
rails_store/views/devise/registrations/new.html.erb
<h2>Sign up</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "off" %></div>
rails g devise:views
invoke Devise::Generators::SharedViewsGenerator
exist app/views/devise/shared
identical app/views/devise/shared/_links.html.erb
invoke form_for
exist app/views/devise/confirmations
identical app/views/devise/confirmations/new.html.erb
exist app/views/devise/passwords
identical app/views/devise/passwords/edit.html.erb
identical app/views/devise/passwords/new.html.erb
@andrekibbe
andrekibbe / stack.rb
Last active August 29, 2015 14:14 — forked from JoshCheek/stack.rb
# The stack I wrote for http://vimeo.com/26391171
# Note that there is an intentional bug in the each method :)
class Stack
Node = Struct.new :data, :next
def push(data)
@head = Node.new data, @head
end
@andrekibbe
andrekibbe / 0_reuse_code.js
Last active August 29, 2015 14:11
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
@andrekibbe
andrekibbe / edit.html.erb
Last active August 29, 2015 14:11
Improved Back buttons for edit.html.erb & show.html.erb
# For Alex Yang's Udemy course: The Startup's Guide to Ruby on Rails
# https://www.udemy.com/the-startups-guide-to-web-development-with-ruby-on-rails
<h1>Editing listing</h1>
<%= render 'form' %>
<%= link_to 'Show', @listing, class: "btn btn-link" %> |
# Change from listing_path shown in Lecture 30 and previous lectures
<%= link_to 'Back', seller_path, class: "btn btn-link"%>
@andrekibbe
andrekibbe / listing.rb
Last active August 29, 2015 14:11
Working code to host images separately in Development and Production
# For Alex Yang's Udemy course: The Startup's Guide to Ruby on Rails
# https://www.udemy.com/the-startups-guide-to-web-development-with-ruby-on-rails
class Listing < ActiveRecord::Base
if Rails.env.production?
has_attached_file :image,
:styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "default.jpg",
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml"),
:path => ":style/:id_:filename"