View gist:deef6cab63fecb253a061f9be16a57d2
[2018-03-01 11:17:26.549751]: While bootstrappping, fork between our block: D2AFFA6D4205258374F7B38CDAE9FAFA76D3905789818F339676A099D3C9817A and block 1A0E6679E59783E35295DEE23D0CB253F3D52F7FDFE7C6C4A7A7245C32929801 both with root 8F1FD01CD1407521F24AC315681DA5826D4D931A4EDA58E74F444B413AF170B8
[2018-03-01 11:17:58.762764]: While bootstrappping, fork between our block: 0978DE900C7B354122235C8C20BB4C0F9D8CE065B1EBBBC7AFD94FBD468E81BE and block F6B57FB5F1EF5D2919FB31454136D0A0EA7D000A73BEC603B8ECDBD36ADAB33B both with root EDE639C142DD851E4D162791DC7D803BDEA13A2EF53D7ED166DCD81DB4CD4239
[2018-03-01 11:18:00.986386]: While bootstrappping, fork between our block: 41C73322F0BF8513A16EAF75AE15CE7DB6F79CF98982C2C389EF1E1E2B03B652 and block CEC34C0D90E9AA43A833AB03103819970B2757B0DC7DE2A09206EBF1EB438E64 both with root 9B61AB4AAA741E9D395BB840951D81B5D1EB7B221FA857463DDB0D68A835F066
[2018-03-01 11:18:04.946908]: While bootstrappping, fork between our block: 7B9395B1144059204095138B9335CE192B1BBB14223734AB4FD284DE9D08
View fonts.js
// In the TypeTool, the StyleRun defines all of the different styles
// that are applied to a text layer. Each style is defined in the RunArray,
// and the character indices for each style is defined in the RunLengthArray,
// i.e. the first style exists for 7 characters, the 2nd for 7 characters,
// and the third for 10 characters.
> typeTool.engineData.EngineDict.StyleRun
{ DefaultRunData: { StyleSheet: { StyleSheetData: {} } },
[ { StyleSheet: [Object] },
{ StyleSheet: [Object] },

Project Structure

Put all of your application code (including your package.json and node_modules folder) into a folder in this directory named Package. The entry point is Package/index.js.

Getting Started

  1. Install AWS CLI
    • brew install awscli
  2. Configure AWS CLI
    • aws configure --profile [name of your project]
      • AWS Access Key ID: [paste-access-key-id-here]
View decorate3.rb do |comment|
comment['member']['blocked'] = member_is_blocking?(comment['member'])
comment['body'] = body_for(comment)
comment['member_has_voted'] = member_has_voted?(comment)
comment['children'] = decorate!(comment['children'])
View decorate2.rb
def member_is_blocking?(other_member)
def blocked_member_ids
return [] if @current_member.nil?
@blocked_member_ids ||= @current_member.blocked_members.pluck(:id)
def member_has_voted?(comment)
View decorate.rb
reject { |comment|
# Comment is deleted with no children, always hide
next true if deleted?(comment) && comment['children'].empty?
# Comment is your own, always show
next false if is_own_comment?(comment)
# Pending comment with no replies
next true if pending?(comment) && comment['children'].empty?
View fetch4.rb
# If the comment tree exists in cache, it will be pulled from cache without
# doing any extra processing. If it doesn't exist in cache, we do all of the
# stuff I wrote about above.
data = Rails.cache.fetch(Comment.cache_key_for(@article, @params[:sort])) do do |data|
# Each data object contains the comment, it's reply_to (if applicable), and
# the comment children. Calling as_json will convert all of the data to a
# plain JSON-like object.
View fetch3.rb
# In order to build the tree structure, we select comments that are only root nodes,
# i.e. comments that are not a reply. From there, we can build the tree structure based
# on their children, which we collected earlier.
transform_node_index( { |node_id, data| data[:parent].nil? }.values)
# This is a recursive method that will traverse the comment structure, and run for
# the children of each comment. In the end, once the recursion finishes, a tree pops out.
def transform_node_index(nodes) do |data|
View fetch2.rb
node_index.each do |node_id, data|
# This is a root node, no processing to do.
next if data[:node].ancestry.nil?
# Here we check the nesting depth to make sure it is not over the max
# allowed depth.
assigned_parent_id = nil
if data[:node].depth > Comment::MAX_DEPTH
# Comment is nested deeper than the max allowed depth, which means we
# convert it to a "reply to" style comment and move it up the tree to
View fetch.rb
# We create an index to store all of the comments in the tree,
# indexed by ID. This lets us quickly build out the comment structure
# as we iterate over each comment.
node_index =
nodes.each do |node|
node_index[] = {
node: node,
parent: nil,
reply_to: nil,
children: []