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
# 「follow_redirectsオプションを無効にできない不具合」を修正するモンキーパッチ | |
# リポジトリの最新版では修正済み | |
# 対象はappengine-apis-0.0.12 | |
module AppEngine | |
module URLFetch | |
module_function | |
def build_urlfetch_request(url, options) # :nodoc: | |
method = options.delete(:method) || 'GET' | |
payload = options.delete(:payload) |
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
# 「memcacheが適切に失効しない不具合」を修正するモンキーパッチ | |
# 対象はappengine-apis-0.0.12 | |
module AppEngine | |
class Memcache | |
def put(key, value, expiration, mode) | |
check_write | |
convert_exceptions do | |
key = memcache_key(key) | |
value = memcache_value(value) |
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
# 「memcacheで日本語キーが使用できない不具合」を修正するモンキーパッチ | |
# 対象はappengine-apis-0.0.12 | |
module AppEngine | |
class Memcache | |
def memcache_key(obj) | |
key = obj | |
key = java.lang.String.new(key.to_s) if key | |
key | |
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
# 「memcacheに日本語文字列を格納すると文字化けしてしまう不具合」を修正するモンキーパッチ | |
# 対象はappengine-apis-0.0.12 | |
module AppEngine | |
class Memcache | |
def memcache_value(obj) | |
case obj | |
when Fixnum | |
java.lang.Long.new(obj) | |
when Float |
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 Enumerable | |
def retry_if(*klasses) | |
e = nil | |
self.each { |arg| | |
begin | |
return yield(arg) | |
rescue *klasses => e | |
next | |
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
# 「タスクキューを追加てきない不具合」を修正するモンキーパッチ | |
# 対象はappengine-apis-0.0.12 | |
module AppEngine | |
module Labs | |
module TaskQueue | |
class Task | |
def add(queue=nil) | |
queue = Queue.new unless queue.kind_of? Queue | |
@handle = queue.java_queue.add(_task) |
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 MessagePack | |
def self.pack(obj, schema = nil) | |
ostream = java.io.ByteArrayOutputStream.new | |
packer = org.msgpack.Packer.new(ostream) | |
value = self.ruby_to_java(obj) | |
if schema | |
packer.packWithSchema(value, org.msgpack.Schema.parse(schema)) | |
else |
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 "stringio" | |
module MessagePackPure | |
def self.unpack(binary) | |
io = StringIO.new(binary) | |
return self.read(io) | |
end | |
def self.read(io) |
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
const int IRLED_PIN = 13; | |
const unsigned long IRLED_TIMEOUT = 20 * 1000; // ms | |
char buffer[16] = {0}; | |
unsigned char buffer_counter = 0; | |
unsigned long irled_expire = 0; | |
void setup() | |
{ | |
pinMode(IRLED_PIN, OUTPUT); |
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
#include "pins_arduino.h" | |
#include <SPI.h> | |
const int MCP4922_LDAC = 9; | |
char buffer[16] = {0}; | |
unsigned char buffer_counter = 0; | |
int da0_value = 0; | |
void mcp4922_init() |
OlderNewer