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
# frozen_string_literal: true | |
module Hodor | |
class MainService | |
def initialize( | |
foo_klass: Foo | |
bar_service: Hodor::BarService.new, | |
baz_service: Hodor::BazService.new, | |
qux_service: Hodor::QuxService.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
module DependencySupport | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
# Substitutes a give dependency with a provided value | |
# will raise an exception if a provided dependency is missing | |
# @param [Sumbol] dependency_name | |
# @param [*] value |
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
-- You'll need the post GIS extensions installed on your Postgres instance | |
-- https://postgis.net/ | |
CREATE TABLE rentals ( | |
id INTEGER UNIQUE, | |
price_in_cents INTEGER, | |
url TEXT, | |
-- Used to determine uniqueness of the posting, perform a SHA hash of the content | |
hash TEXT, | |
-- This instructs PG to make location a geographic point on the 4326 sphere (The appromiximation of the earth used by GIS systems) |
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
val eventuallyFoo = ServiceOne.get // can be fired in parallel | |
val eventuallyBar = ServiceTwo.get | |
val maybeBax = Option(...) | |
for { | |
foo <- eventuallyFoo | |
sideEffect = maybeBax.getOrElse('dooo') | |
bar <- eventuallyBar | |
baz <- DB.get(foo.id, bar.id, sideEffect) |
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
MyApp.MainPage.MainPain: SC.MainPane.create({ | |
didCreateLayer: function(){ | |
SC.Event.add($('#login-name')[0], 'change', this, this.userNameDidChange); | |
SC.Event.add($('#login-passwd')[0], 'change', this, this.passwordDidChange); | |
}, | |
userNameDidChange: function(){ | |
AuthAo.loginController.set('username', $('#login-name').val()); | |
}, |