- Everything as a service
- Test it!
- Problem statement: Testing a server/client HTTP API
- Good plan:
- Create API
- Build client lib that can be used in confusmer apps
- Make it easy for consumer apps to test w/ our client library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script does the following: | |
# 1/ capture and download the latest backup | |
# 2/ load it to your local database | |
# 3/ run your app and open Safari | |
# Just replace any uppercase string with your own data | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/ability.rb | |
# All front end users are authorized using this class | |
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new | |
can :read, :all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
- Problem: Want users to have "rich client exp" (even though clients don't know what that means)
- @dhh and @wycats offer different opinions (document vs json api)
- But @noelrap just wants to write an e-commerce site
- We tend to split stuff up into client stuff and server stuff between the user and data
- @dhh says that the focus is on the server. The app lives on the server
- @wycats says that the client is the focus, and the server just does whatever the client can't do (i.e. validation, persistence)
- Where does the heart of your application live?
- people don't read on the web
- how users read on the web http://www.nngroup.com/articles/how-users-read-on-the-web/
- F shaped pattern (Jakob Nielsen)
- what readers look at
- menaningful text and images
- the begining of paragraphs
- bullet lists
- variations in typeface
- never use a metaphor, simile, or other figure of speech which you are used to seeing in print.
- never use a long word where a short one will do
- if it's possible to cut a word out, always cut it out.
- never use the passive where you can use the active
- never use a foreign phrase, a scientific word, or a jargon word if you can think of an everday English equivalent
- break any of these rules sooner than say anything outright barbarrous
#Five guiding principles
- minimalism
- get out of the way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
OlderNewer