Skip to content

Instantly share code, notes, and snippets.

View josepjaume's full-sized avatar

Josep Jaume Rey josepjaume

View GitHub Profile

A future version of Ember will come with a new templating engine known as HTMLBars.

The original motivation for HTMLBars was to allow helpers and properties to have better contextual information about what they were bound to.

So for example, consider a template like this:

<a href="{{url}}">{{link}}</a>
@txus
txus / duplex.rb
Created August 29, 2013 16:37
Broadcast TCP traffic. Spike
require 'celluloid/io'
module Duplex
class Server
include Celluloid::IO
finalizer :finalize
def initialize(name, host, port)
@name = name
puts "[#{name}] *** Starting server on #{host}:#{port}"
@phil-monroe
phil-monroe / 01-Faye Rails.md
Last active March 14, 2016 12:35
Embed scalable Faye into Rails app hosted with Puma, Thin, etc.

This is just a jotting of notes on how to embed Faye into a single Rails process. Makes it nice to do simple real time things without the need for a separate Faye server/process.

Also uses Faye Redis to work across load balanced Rails apps.

You also need to copy the compiled javascript into vendor/assets/javascripts and include into application.js manifest.

Ignore the numbers in the file names... just used to add order to the Gist.

This uses the faye/faye Github repo at edc5b42f6560d31eae61caf00f6765a90e1818d1 since I wanted to use with the Puma rack server and that is only available in the master branch (until Faye 1.0)

@oriolgual
oriolgual / hypermodel.rb
Created August 9, 2012 19:28
Readme Driven Development for Hypermodel
module Hypermodel
module ClassMethods
# Public: Adds a new link to the _links section of the representation.
#
# relation - A String or Symbol with the name of the relation. It will
# also be used as a method name to call in the Hypermodel
# class or in the resource (as a second option) to get the href
# if no href provided.
# href - An optional String with the href of the link.
# options - An optional hash to add to the link (like tempalted: true).
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')