-
Performs routines concurrently in one or more reactors, each reactor runnning in its own thread.
-
Does not back routines with fibers or threads because of their overhead. Instead routines are defined as a block that is called on each tick of the reactor until the routine says it's finished. The block is given the underlying routine that can hold state, etc. It's a different way of coding as the routine cannot be paused or resumed like fibers can.
-
Reactors are as equitable as possible when allocating compute time. Developers define a compute "unit" in terms of one call of their routine's block. Reactors call one tick of every routine in sequence. This is kind of similar to reductions in Erlang, but differs in that it gives each routine one tick instead of counting.
This file contains 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
pw.define("analytics", { | |
authorization: null, | |
constructor() { | |
window.fetch(this.config.authorization + `?authenticity=${this.config.authenticity}`).then(async (response) => { | |
if (response.status === 200) { | |
let payload = await response.json(); | |
this.authorization = payload.authorization; | |
const Proc = await import("https://cdn.skypack.dev/pin/@proc.dev/[email protected]/mode=imports,min/optimized/@proc.dev/client.js"); |
This file contains 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/monads" | |
include Dry::Monads[:maybe] | |
class Presenter | |
class << self | |
def presents(name, &block) | |
presentations[name] = block | |
end | |
def perform(**presentables) |
This file contains 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 "forwardable" | |
module Inflection | |
class Inflector | |
def pluralize(string) | |
string + "s" | |
end | |
end | |
class << self |
This file contains 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 Foo | |
def foo | |
bar | |
end | |
def bar | |
end | |
end | |
class Whatever |
This file contains 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
/usr/app/vendor/bundle/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi/library.rb:112: [BUG] Illegal instruction at 0x00007f6b11b55285 | |
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] | |
-- Control frame information ----------------------------------------------- | |
c:0052 p:---- s:0269 e:000268 CFUNC :open | |
c:0051 p:0022 s:0263 e:000262 BLOCK /usr/app/vendor/bundle/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi/library.rb:112 [FINISH] | |
c:0050 p:---- s:0254 e:000253 CFUNC :each | |
c:0049 p:0113 s:0250 e:000249 BLOCK /usr/app/vendor/bundle/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi/library.rb:109 [FINISH] | |
c:0048 p:---- s:0243 e:000242 CFUNC :map | |
c:0047 p:0069 s:0239 e:000238 METHOD /usr/app/vendor/bundle/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi/library.rb:99 | |
c:0046 p:0079 s:0232 e:000231 CLASS /usr/app/vendor/bundle/ruby/2.6.0/gems/sassc-2.2.1/lib/sassc/native.rb:11 |
This file contains 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 | |
require "log4r" | |
require "pakyow/connection" | |
require "pakyow/error" | |
require "pakyow/logger/colorizer" | |
require "pakyow/logger/timekeeper" |
This file contains 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 Proxy | |
def initialize(port:, host:) | |
@port, @host = port, host | |
@destination = "#{@host}:#{@port}" | |
@client = Async::HTTP::Client.new( | |
Async::HTTP::URLEndpoint.parse( | |
"http://#{@destination}" | |
) | |
) | |
end |
This file contains 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
# Platform health check ip addresses. | |
# | |
HEALTH_CHECK_ADDRS = [ | |
IPAddr.new("209.85.152.0/22"), | |
IPAddr.new("209.85.204.0/22"), | |
IPAddr.new("35.191.0.0/16"), | |
IPAddr.new("130.211.0.0/22"), | |
IPAddr.new("35.191.0.0/16") | |
] |
This file contains 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
NOT_PASSED = Object.new | |
def foo(bar: NOT_PASSED) | |
if bar.equal?(NOT_PASSED) | |
... | |
end | |
end |
NewerOlder