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
start = nil | |
NATS.start(:servers => ['nats://198.199.103.139:4222']) do | |
start = Time.now | |
NATS.subscribe('demo', :queue => 'group.things') do |msg, reply| | |
puts "Hitting node 1 with #{msg}" | |
NATS.publish(reply, "Polo1!") | |
end | |
NATS.subscribe('demo', :queue => 'group.things') do |msg, reply| |
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
package main | |
import ( | |
"bytes" | |
"strconv" | |
) | |
//// | |
// Query Builder | |
// |
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
Thread.new do | |
trap(:TRAP) do | |
::Thread.list.each do |thread| | |
puts <<-THREAD_TRACE | |
#{thread.inspect}: | |
#{thread.backtrace.try(:join, $INPUT_RECORD_SEPARATOR)}" | |
THREAD_TRACE | |
end | |
end | |
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
class EnumDeliveryType < ::Protobuf::Enum | |
define :STANDARD, 1 | |
define :PRIORITY, 2 | |
define :NEXT_DAY, 3 | |
define :OVERNIGHT, 4 | |
end | |
# # # # # # # # # # # # # PART 1 # # # # # # # # # # # # # | |
## |
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
trait Queryable { | |
fn pluralized_table_name(&self) -> String; | |
fn predicates(&self) -> &Vec<String>; | |
fn has_limit(&self) -> bool { | |
return self.limit_value() >= 0; | |
} | |
fn limit_value(&self) -> i64; |
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
defmodule Rpc do | |
defmodule ServiceDirectory do | |
defmodule Instance do | |
defstruct address: nil, port: nil, expires_at: nil, uuid: nil | |
end | |
## | |
# USAGE: | |
# | |
# Rpc.ServiceDirectory.start_link(port: 53023) |
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 "socket" | |
# Detect if a socket is in CLOSE_WAIT | |
def socket_in_close_wait?(socket) | |
# Will return empty string on EOF (closed socket) | |
socket.recv_nonblock(1, ::Socket::MSG_PEEK) == "" | |
rescue IO::WaitReadable | |
false | |
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
class AnyPage | |
attr_reader :sql | |
def initialize(sql, options = {}) | |
@page_size = options.fetch(:page_size) { 1000 } | |
@sql = sql | |
@total_pages = nil | |
end | |
def self.page(sql, nth, options = {}) |
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
;;; ujelly-theme-autoloads.el --- automatically extracted autoloads | |
;; | |
;;; Code: | |
;;;### (autoloads nil "ujelly-theme" "ujelly-theme.el" (21808 38161 | |
;;;;;; 0 0)) | |
;;; Generated autoloads from ujelly-theme.el |
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
Benchmark.measure { 10_000.times { ActionSubscriber::Publisher.publish("test", "test", "test") } } | |
5.590000 2.110000 7.700000 ( 14.262266) | |
Benchmark.measure { 10_000.times { ActionSubscriber::Publisher.publish_async("test", "test", "test") } } | |
0.030000 0.000000 0.030000 ( 0.025184) |