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 SomeServiceWithApplyAndCall < CRUD::CreateService | |
def apply(attributes, to_one, to_many, options) | |
self.(attributes[:name], to_one[:foo], to_many[:bar]) | |
end | |
def call(name, foo_id, bar_ids) | |
# the real service stuff | |
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
module Orders | |
module Teams | |
class CreateTeam < FoodeeService | |
dependency :client_dao, Client | |
# @param [Client] client_id | |
def call(client_id, name = nil) | |
client = client_dao.find client_id |
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
function fizzBuzz(n) { | |
for(let i = 0; i < n; i++){ | |
const mod3 = i % 3; | |
const mod5 = i % 5; | |
let str; | |
if ( mod3 == 0 && mod5 == 0){ | |
str = "FizzBuzz" | |
} |
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
let fizzbuzz = (i) => | |
switch (i mod 3, i mod 5) { | |
| (0, 0) => "FizzBuzz" | |
| (0, _) => "Fizz" | |
| (_, 0) => "Buzz" | |
| _ => string_of_int(i) | |
}; | |
for (i in 1 to 100) { | |
Js.log(fizzbuzz(i)) |
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
# JSONAPI::RelationshipBuilder#define_relationship_methods | |
# model_class.ancestors.collect{|ancestor| ancestor.name}.include?('ActiveRecord::Base') | |
# replace with this | |
if model_class && model_class < ActiveRecord::Base |
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
import Ember from 'ember'; | |
const { | |
Component | |
} = Ember; | |
/** | |
* Wrapper around "semantic-ui-daterangepicker#~1.3.21", | |
*/ |
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
import Ember from 'ember'; | |
const { | |
Component | |
} = Ember; | |
/** | |
* Wrapper around "semantic-ui-daterangepicker#~1.3.21", | |
*/ |
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
# Create a global connection pool at parse time | |
$redis_connection_pool = ConnectionPool::Wrapper.new( | |
size: ENV['REDIS_CONNECTION_POOL_SIZE'] || ENV['RAILS_MAX_THREADS'] || 5, | |
timeout: ENV['REDIS_CONNECTION_TIMEOUT'] || 3) { | |
Redis.new(url: ENV['REDIS_URL']) | |
} | |
# Helper for returning a redis client from the with or without a namespace | |
def with_redis(namespace = nil) | |
$redis_connection_pool.with do |connection| |
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 Foo {}; | |
let foos = []; | |
let interval; | |
interval = setInterval(() => { | |
foos.push(new Foo()); | |
if(foos.length > 10000) { | |
clearInterval(interval); | |
console.log('done'); |
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 Foo {}; | |
window.foo = new Foo(); |