Skip to content

Instantly share code, notes, and snippets.

View brainopia's full-sized avatar

Ravil Bayramgalin brainopia

View GitHub Profile
From 038eb65be7d071755288b0ab95de27e97350d8c2 Mon Sep 17 00:00:00 2001
From: brainopia <[email protected]>
Date: Sat, 15 Jan 2011 13:49:55 +0300
Subject: [PATCH 1/3] Add observer_path method to load observers matching given pattern
---
activemodel/lib/active_model/observing.rb | 37 ++++++++++++++++++++++++++++-
activemodel/test/cases/observing_test.rb | 13 ++++++++++
2 files changed, 49 insertions(+), 1 deletions(-)
@brainopia
brainopia / gist:748919
Created December 20, 2010 20:17
fix conflict between vkontakte and mailru loaders
(function(w){
var oldHandler = w.fastXDM.onMessage
w.fastXDM.onMessage = function(e){
if (e.origin != "http://connect.mail.ru")
oldHandler(e)
}
if (w.addEventListener){
w.removeEventListener('message', oldHandler, false)
From 68341b105bab10cc8da724e967c848963eef8f71 Mon Sep 17 00:00:00 2001
From: brainopia <[email protected]>
Date: Sun, 19 Dec 2010 22:27:30 +0300
Subject: Add tld_length option when using domain :all in cookies
This allows to use cookies with short base domains like app.me
---
.../lib/action_dispatch/middleware/cookies.rb | 18 +++++-----
actionpack/test/dispatch/cookies_test.rb | 36 ++++++++++++++++++++
2 files changed, 45 insertions(+), 9 deletions(-)
From cc6423ad5b0fbd50d729780042a1cb592fe4706c Mon Sep 17 00:00:00 2001
From: brainopia <[email protected]>
Date: Thu, 9 Dec 2010 19:12:56 +0300
Subject: Support list of possible domains for cookies
Eg, :domain => %w(example1.com example2.com .example3.com),
appropriate domain from this list will be set for current request
---
.../lib/action_dispatch/middleware/cookies.rb | 3 +
actionpack/test/dispatch/cookies_test.rb | 45 ++++++++++++++++++++
@brainopia
brainopia / gist:734907
Created December 9, 2010 16:15
Fix edge cases for domain :all option on cookie store
From 4fe9191b7898384503fd40f35ee4f9d107cbea83 Mon Sep 17 00:00:00 2001
From: brainopia <[email protected]>
Date: Thu, 9 Dec 2010 18:38:52 +0300
Subject: Fix edge cases for domain :all option on cookie store
Dont set explicit domain for cookies if host is not a domain name
---
.../lib/action_dispatch/middleware/cookies.rb | 7 ++++-
actionpack/test/dispatch/cookies_test.rb | 21 ++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
class Driver
def execute(sql)
fiber = Fiber.current
evented_execute(sql) { fiber.resume }
fiber.yield
end
end
pool = FiberPool.new 10
require 'em-synchrony'
require 'em-synchrony/em-http'
require 'em-synchrony/iterator'
=begin
Currently Synchrony::Iterator does not support synced calls inside,
but it can by integrating fiber pool inside.
It even makes more sense for concurrency option of Iterator to be fiber pool size.
=end
require 'em-resolv-replace'
require 'em-synchrony/em-http'
require 'fiber_pool'
gem 'em_postgresql'
class Pool
delegate :spawn, to: :@pool
attr_reader :processed, :concurrent
def initialize(size)
require 'em-synchrony'
require 'em-synchrony/em-http'
EventMachine.synchrony do
multi = EventMachine::Synchrony::Multi.new
multi.add :a, EventMachine::HttpRequest.new('http://ya.ru/').aget
EventMachine.add_timer(2) do
multi.perform; EventMachine.stop
end
end
-0.7071*cos(x1)*cos(x2)*cos(x3)*cos(x4)*cos(x5)*cos(x6)+0.7071*sin(x2)*cos(x3)*cos(x4)*cos(x5)*cos(x6)-0.7071*sin(x1)*sin(x3)*cos(x4)*cos(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*sin(x3)*sin(x4)*cos(x5)*cos(x6)-0.7071*sin(x2)*sin(x3)*sin(x4)*cos(x5)*cos(x6)-0.7071*sin(x1)*cos(x3)*sin(x4)*cos(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*cos(x3)*sin(x4)*sin(x5)*cos(x6)-0.7071*sin(x2)*cos(x3)*sin(x4)*sin(x5)*cos(x6)+0.7071*sin(x1)*sin(x3)*sin(x4)*sin(x5)*cos(x6)+0.7071*cos(x1)*cos(x2)*sin(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*sin(x2)*sin(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*sin(x1)*cos(x3)*cos(x4)*sin(x5)*cos(x6)-0.7071*cos(x1)*sin(x2)*sin(x6)-0.7071*cos(x2)*sin(x6)
0.7071*cos(x1)*cos(x2)*cos(x3)*cos(x4)*cos(x5)*sin(x6)-0.7071*sin(x2)*cos(x3)*cos(x4)*cos(x5)*sin(x6)+0.7071*sin(x1)*sin(x3)*cos(x4)*cos(x5)*sin(x6)-0.7071*cos(x1)*cos(x2)*sin(x3)*sin(x4)*cos(x5)*sin(x6)+0.7071*sin(x2)*sin(x3)*sin(x4)*cos(x5)*sin(x6)+0.7071*sin(x1)*cos(x3)*sin(x4)*cos(x5)*sin(x6)-0.7071*cos(x1)*cos(x2)*cos(x3)*sin(x4)*sin(x5)*sin(x6)+0.7071*sin(x2)*cos(