Skip to content

Instantly share code, notes, and snippets.

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());
},
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)
-- 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)
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
@joegaudet
joegaudet / bad_state.rb
Last active August 24, 2018 21:51 — forked from jilucev/bad_state.rb
Enema of the state
# 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
)