This file contains hidden or 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
# These don't load properly with this technique, so we preload them if the app | |
# needs them. :-( | |
require 'psych' | |
require 'bigdecimal' | |
alias zomg_require require | |
auto_create_hash = proc do |h,k| | |
hash = h[k] = {} | |
hash.default_proc = auto_create_hash |
This file contains hidden or 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
require 'opal' | |
require 'clearwater' | |
require 'routing' | |
class Layout | |
include Clearwater::Component | |
include Routing | |
def render | |
div([ |
This file contains hidden or 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
require 'routing' | |
class Layout | |
include Clearwater::Component | |
include Routing | |
def render | |
div([ | |
nav([ | |
Link.new({ href: '/' }, 'Home'), |
This file contains hidden or 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
def foo | |
florpty_doop | |
rescue => e | |
zomg_lol | |
end | |
foo |
This file contains hidden or 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
class Widget | |
attr_writer :dependency | |
def dependency | |
@dependency ||= Dependency.new | |
end | |
end | |
widget = Widget.new | |
widget.dependency = StubbedDependency.new |
This file contains hidden or 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
source 'https://rubygems.org' | |
gem 'clearwater', '~> 1.0.0.rc1' | |
gem 'opal-rails' | |
gem 'grand_central' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.2.6' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' |
This file contains hidden or 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
class OrderPriceCalculation | |
def initialize(order, tax_rate:) | |
@order = order | |
@tax_rate = tax_rate | |
end | |
def total | |
subtotal + sales_tax + fees | |
end |
This file contains hidden or 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
const { h, create, diff, patch } = require('virtual-dom'); | |
class App { | |
constructor (count) { | |
this.count = count | |
} | |
render () { | |
return h('div', {}, [ | |
new MyThunk(this.count), |
This file contains hidden or 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
$ rails g model User email password_digest |
This file contains hidden or 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
class GanttChart | |
include Clearwater::Component | |
include Clearwater::CachedRender | |
attr_reader :tasks | |
def initialize(tasks) | |
@tasks = tasks | |
end | |