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
# https://github.com/elastic/elasticsearch-rails/pull/361 | |
module Elasticsearch | |
module Model | |
module Adapter | |
# The default adapter for models which haven't one registered | |
# | |
module Sequel | |
Adapter.register( | |
self, | |
lambda do |klass| |
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
@JRubyMethod(meta = true) | |
public static IRubyObject for_fd(ThreadContext context, IRubyObject _klass, IRubyObject _fileno) { | |
Ruby runtime = context.runtime; | |
int fileno = (int)_fileno.convertToInteger().getLongValue(); | |
RubyClass klass = (RubyClass)_klass; | |
final RubyClass UNIXSocket = runtime.getClass("UNIXSocket"); | |
RubyUNIXSocket unixSocket = (RubyUNIXSocket)(Helpers.invoke(context, UNIXSocket, "allocate")); | |
try { | |
// begin hack |
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
# Sequel assoc_ids / assoc_ids= | |
module SequelAssociationIds | |
def one_to_many(name, *args, &block) | |
super | |
create_ids_accessor(name) | |
end | |
def many_to_many(name, *args, &block) | |
super | |
create_ids_accessor(name) |
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
NoMethodError: undefined method `[]' for nil:NilClass | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:751:in `type_convertor' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:777:in `process_result_set' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:775:in `times' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:775:in `process_result_set' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:714:in `fetch_rows' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:251:in `execute' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:651:in `statement' | |
/path/gems/sequel-4.23.0/lib/sequel/adapters/jdbc.rb:246:in `execute' | |
/path/gems/sequel-4.23.0/lib/sequel/connection_pool/threaded.rb:103:in `hold' |
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
// doesn't work | |
val receiveReplica: Receive = withPersistence { (sender, key, id) => sender ! SnapshotAck(key, id) } { | |
var expectedSeq = 0 | |
{ | |
case Get(key, id) => | |
sender ! GetResult(key, kv.get(key), id) | |
case OperationTimeout(seq) => | |
persisting.get(seq).foreach { | |
case PersistingValue(_, timer, _, _) => | |
timer.cancel() |
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
val connection = Http(context.system).outgoingConnection("localhost", 8008) | |
val request = | |
RequestBuilding.Get("/repos/mrbrdo/test_repo/pulls") | |
.withHeaders( | |
RawHeader("Accept", "application/vnd.github.v3+json")) | |
async[Unit] { | |
val response = await(Source.single(request).via(connection).runWith(Sink.head)) | |
response.status match { | |
case status if status.isSuccess() => |
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
def paypal_business_param | |
# as if the name of this type isn't bad enough | |
if params[:txn_type] == 'recurring_payment_suspended_due_to_max_failed_payment' | |
params[:receiver_email] | |
else | |
params[:business] | |
end | |
end | |
def paypal_subscr_id_param |
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
-----> Using RVM environment 'jruby-1.7.6@xxx' | |
Using /home/xxx/.rvm/gems/jruby-1.7.6 with gemset xxx | |
-----> Creating a temporah | |
-----> Creating a tempora) | |
-----> Creating a temporas | |
From xxx.xxx:mrbrdo/xxx | |
0974861..9cddaa9 production -> production | |
-----> Creating a tempora' | |
-----> Creating a tempora. | |
-----> Creating a tempora. |
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
User.select_map(:id) | |
# => [2] | |
User.select_map([:id, :email]) | |
# => [[2, "[email protected]"]] | |
User.select_hash(:id, :email) | |
# => {2=>"[email protected]"} | |
User.select(:id, :email).naked.all | |
# => [{:id=>2, :email=>"[email protected]"}] |
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 Commit < Sequel::Model | |
end | |
class Repository < Sequel::Model | |
one_to_many :recent_commits, :class => 'Commit', | |
eager_limit_strategy: true, | |
order: Sequel.desc(:id), | |
limit: 3 | |
end |
NewerOlder