Notes/summary from weekend discussion (Jan, 31).
nil == null == undefined
nil # => null
true # => true
false # => false| class User < Vienna::Model | |
| attributes :first_name, :last_name | |
| end | |
| user = User.new | |
| first = Frappuccino::Stream.new(user).capture(:changed_first_name) | |
| last = Frappuccino::Stream.new(user).capture(:changed_last_name) | |
| # last name is any change to first or last name | |
| last_name = first.merge(last).map { "#{user.first_name} #{user.last_name}" } |
| Product.find(1).then do |product| | |
| puts "product: #{product}" | |
| end.else do | |
| puts "failed :(" | |
| end |
| describe NewProductView do | |
| # do we have to repeat this? | |
| view NewProductView | |
| it "tries to add product on click submit" do | |
| expect(view).to receive(:add_product).once | |
| find('#submit').click | |
| end | |
| end |
| require 'opal' | |
| require 'rails_templates' | |
| p Template.paths | |
| # => ['login', 'logout', 'user', 'user/new'] |
| class Bar < Foo | |
| end |
| // runtime | |
| Opal.modules = {}; | |
| Opal.register = function(name, body) { | |
| Opal.modules[name] = body; | |
| }; | |
| Opal.require = function(name) { | |
| var module = Opal.modules[name]; | |
| module LocalStorage | |
| def self.[](name) | |
| `localStorage.getItem(name)` | |
| end | |
| def self.[]=(name, value) | |
| `localStorage.setItem(name, value)` | |
| end | |
| def self.key?(name) |
| .row | |
| .col-md-8 | |
| %h2 Items | |
| .col-md-3 | |
| %h2 Shopping List | |
| = bind_unless cart_empty? do | |
| %a.btn.btn-default#clear-cart(style="width: 50%") | |
| = bind clear_title |
| require 'opal' | |
| require 'sinatra' | |
| get '/' do | |
| <<-EOS | |
| <!doctype html> | |
| <html> | |
| <head> | |
| <script src="/assets/application.js"></script> | |
| </head> |