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 "dry-types" | |
module DryTS | |
# We use this method to mark a type for inclusion in our generated TS types. | |
def ts_export(_assigned_type) | |
extract_constants! | |
# ... Other stuff for exporting TS | |
end | |
def extract_constants! |
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 Web | |
class Application < Lotus::Application | |
configure do | |
## | |
# BASIC | |
# | |
# Define the root path of this application. | |
# All the paths specified in this configuration are relative to this one. | |
# |
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 publish_form(slug_unique, publishable, document) | |
PublishFormRenderer.render(slug_unique: slug_unique, publishable: publishable, document: document, context: self) | |
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
require 'skywalker/command' | |
module Skywalker | |
class Command | |
def transaction(&block) | |
block.call | |
end | |
end | |
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
require 'active_record' | |
module Skywalker | |
class Command | |
################################################################################ | |
# Class interface | |
################################################################################ | |
def self.call(*args) | |
new(*args).call | |
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
private def confirm_failure(error) | |
self.error = error | |
run_failure_callbacks | |
end | |
private def run_failure_callbacks | |
# This line fails because on_failure responds_to #call ?! | |
on_failure.call(self) if on_failure.respond_to?(:call) | |
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
App.CommentsNewRoute = Ember.Route.extend({ | |
model: function() { | |
return this.store.createRecord('comment', {post: this.modelFor('post')}); | |
}, | |
actions: { | |
save: function() { | |
var model = this.modelFor('commentsNew'); | |
model.save().then( |
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
array = %w(dog cat aardvark) | |
array.each {|animal| puts animal.upcase } | |
array.map! {|animal| animal.reverse } | |
array.select {|animal| animal.include? 'a' } | |
array.sort_by(&:length) | |
array << 'dog' | |
array.uniq! | |
hash = {cat: "meow", dog: "woof", aardvark: "sluuurp"} | |
hash.keys.join(" and ") |
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
Ember.Application.initializer({ | |
name: 'debug' | |
initialize: (container, app) -> | |
app.d = app.debug = | |
controller: (name) -> container.lookup("controller:#{name}") | |
c: (name) -> container.lookup("controller:#{name}") | |
route: (name) -> container.lookup("route:#{name}") | |
r: (name) -> container.lookup("route:#{name}") |
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
Meloria.Customer = DS.Model.extend({ | |
name: DS.attr('string'), | |
phone: DS.attr('string'), | |
email: DS.attr('string'), | |
dateOnWaitingList: DS.attr('date'), | |
status: DS.attr('number'), | |
local: DS.attr('boolean'), |
NewerOlder