don't need to set database.yml, it is set automatically.
heroku addons:add heroku-postgresql:hobby-dev -a carshare-all
==============
def sign_up_params | |
params.require(:user).permit(:email,:password) | |
end | |
# If user input :email => 'chris@mac.com', :password=> nil | |
puts sign_up_params | |
# $> {"email"=>"123@asdf.com", "password"=>""} | |
puts sign_up_params.select{|k,v| v.present?} |
## << Devise::RegistrationController | |
### Build an user (resource) object from temporary | |
build_resource(sign_up_params.select{|k,v| v.present?}) | |
# > #<User id: nil, created_at: nil, updated_at: nil, email: "a@b.c", encrypted_password: "$2a$10$HufMLSGEoWzbwhVO.IRztuvE8NKTrQgaXNZthem3wid...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil> | |
### :validatable module in devise. (took me three hours) | |
# http://stackoverflow.com/questions/21103138/handle-activerecordrecordnotunique-in-devise-registrations-controller/29792359#29792359 | |
# ActiveRecord::RecordNotUnique in Users::RegistrationsController#create | |
# PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email" DETAIL: Key (email)=() already exists. : INSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" |
Making videos into GIFs on the command-line with gifify I like making gifs.
You also probably like making gifs.
It's a thing we do.
On a regular basis I'll have video from television shows or movies or other video I've taken myself like screencasts that I want to turn into a gif.
Turning video into a gif can be done using online services, but I need a quick way to do it on the command line.
// Will not work after new DOM created on AJAX | |
$('.photo-options-hero').on('click', function() { | |
$(this).closest('.gallery-item').addClass('hero').siblings().removeClass('hero'); | |
}); | |
// Will work after AJAX DOM Creation | |
$('body').on('click', '.photo-options-hero', function() { | |
$(this).closest('.gallery-item').addClass('hero').siblings().removeClass('hero'); | |
}); |
class Car < ActiveRecord::Base | |
belongs_to :owner, class_name: 'FormUser', foreign_key: 'user_id' | |
include AlgoliaSearch | |
algoliasearch id: :permalink do | |
attribute :owner do | |
{ uid: owner.uid } | |
end | |
end |
{ | |
"models": [ | |
{ | |
"id": "BMW_1_Series", | |
"name": "1 Series", | |
"niceName": "1-series", | |
"make": { | |
"id": 200000081, | |
"name": "BMW", | |
"niceName": "bmw" |
- models: | |
- name: 1 Series | |
years: | |
- year: 2008 | |
styles: | |
- submodel: 1 Series Convertible # Becomes "submodel > modelName" | |
trim: 128i | |
- submodel: 1 Series Coupe # Becomes "submodel > modelName" | |
trim: 128i | |
- submodel: 1 Series Coupe |
// node ig-request.js username | |
// 1. visit www.instagram.com/username?__a=1 | |
// 2. save it as ${%Y%m%d}-${username}.json and upload it to a Google Cloud Storage Bucket | |
// 3. Automatically renew cookies so we can continue ot obtain JSONs | |
// 4. deploy it as a Cloud Function (bonus) | |
// 5. Health Monitor and logging. (bonus) | |
const request = require('request'); | |
const fs = require('fs'); |