Skip to content

Instantly share code, notes, and snippets.

web: rails server thin -p 5000
pg: postgres
mem: memcached
red: redis-server > log/redis-server.log
res: rake resque:workers JOBS_PER_FORK=100 COUNT=3 QUEUE=rate_quotes,shipments,batches,email,*
ela: elasticsearch
$('#paste-address').click ->
togglePasteAddress()
$('#add_order_modal').on 'click', '#paste-address', ->
togglePasteAddress()
togglePasteAddress=->
$column = $('.col1')
$column.fadeToggle 100, ->
$('.col1 .control-group').toggleClass('hidden')
[1] pry(main)> CONSTANT = 1
=> 1
[2] pry(main)> CONSTANT = 2
(pry):2: warning: already initialized constant CONSTANT
=> 2
[3] pry(main)> CONSTANT.freeze
=> 2
[4] pry(main)> CONSTANT = 3
(pry):4: warning: already initialized constant CONSTANT
=> 3
def make_groups(names, size)
names.shuffle!.group_by { |i| names.rindex(i) % size }
end
def recent_messages(batch = 250, uid = nil)
get_connection.select('INBOX')
if uid
last_seen = get_connection.uid_fetch(uid, 'ENVELOPE').first.seqno
else
last_seen = get_connection.responses['EXISTS'].first
end
if last_seen > batch

As a rule, I prefer to be explicit and obvious about functions in our products, specifically iOS apps.

I first heard the term "pawing" in reference to UI design when Lion introduced vanishing scroll bars as first seen in iOS. One pundit referred to the act of pulling and pushing on the view in order to see if there is more content as pawing. It wasn't (isn't) obvious that a window or page can be scrolled to reveal more content if there is no visible scroll bar, unless some content can be seen peaking above the fold. Users were left to paw at windows and pages in order to see if there was any more content.

Being the default in iOS and now OS X, we can't do much about vanishing scroll bars. We can, however, ensure that we don't force users to paw at our apps in order to discover core functionality.

One example is in Message Finder. It's not obvious that swiping left reveals a list of senders. The little dots at the bottom help, but I don't think they're obvious. We can do better. If we moved the refresh and

--type-add=ruby=.haml,.rake,.rsel,.builder,.slim
--type-add=html=.html.erb,.html.haml,.html.slim
--type-add=js=.js.erb,.json
--type-add=css=.sass,.less,.scss
--type-set=cucumber=.feature
--type-set=coffeescript=.coffee
--type-set=markdown=.markdown,.mdown,.md,.mkd,.mkdn
--ignore-dir=coverage
--ignore-dir=doc
%w(
scene_01_v2_high.flv
scene_02a_v2_high.flv
scene_02b_v2_high.flv
scene_02c_v2_high.flv
scene_02d_v2_high.flv
scene_03_v2_high.flv
scene_04_v2_high.flv
scene_05_v2_high.flv
scene_06a_v2_high.flv
class Parent
has_many :children, :as => :source
accepts_nested_attributes_for :children
end
class Child
belongs_to :source, :polymorphic => true
validates :source, :presence => :true
@mmaa
mmaa / gist:676309
Created November 15, 2010 01:40
envelope & internal_transactions
class Envelope < ActiveRecord::Base
has_many :internal_transactions
has_many :internal_transactions, :as => :source
def transfers_in
InternalTransaction.where(:envelope_id => self.id)
end
def transfers_out
InternalTransaction.where(:source => self)