Skip to content

Instantly share code, notes, and snippets.

View omo's full-sized avatar

Hajime Morrita omo

  • Mountain View, CA
View GitHub Profile
@omo
omo / link.txt
Last active August 29, 2015 14:17
Title Dialog
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omo
omo / mp-12b.svg
Created March 24, 2015 18:43
Message Pipe benchmark Flame graphs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omo
omo / mojo-small.svg
Created April 15, 2015 00:31
IPC::Channel perf comparison
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omo
omo / gist:11598
Created September 19, 2008 14:57
class Mysql
def async_query(sql)
send_query(sql)
select [ (@sockets ||= {})[socket] ||= IO.new(socket) ], nil, nil, nil
get_result
end
end
@omo
omo / gist:11600
Created September 19, 2008 14:58
/* send_query */
static VALUE send_query(VALUE obj, VALUE sql)
{
MYSQL* m = GetHandler(obj);
Check_Type(sql, T_STRING);
if (GetMysqlStruct(obj)->connection == Qfalse) {
rb_raise(eMysql, "query: not connected");
}
if (mysql_send_query(m, RSTRING_PTR(sql), RSTRING_LEN(sql)) != 0)
mysql_raise(m);
@omo
omo / gist:11604
Created September 19, 2008 15:08
/* sql/client.c */
int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{
...
if (mysql_send_query(mysql,query,length))
DBUG_RETURN(1);
DBUG_RETURN((int) (*mysql->methods->read_query_result)(mysql));
}
@omo
omo / gist:11606
Created September 19, 2008 15:10
/* socket */
static VALUE socket(VALUE obj)
{
MYSQL* m = GetHandler(obj);
return INT2NUM(vio_fd(m->net.vio));
}
;; modified http://www.emacswiki.org/emacs/TinyUrl
(require 'thingatpt)
(defun my-get-shorter-bug-url(longer-uri)
(cond ((string-match "bugs.webkit.org" longer-uri)
(let ((num-start (string-match "[[:digit:]]" longer-uri)))
(concat "http://webkit.org/b/" (substring longer-uri num-start))))
((string-match "http://code.google.com/p/chromium/issues" longer-uri)
(let ((num-start (string-match "[[:digit:]]" longer-uri)))
(concat "http://crbug.com/" (substring longer-uri num-start))))
((error (concat longer-uri " is not bug url")))))
@omo
omo / async testsucks.js
Created September 20, 2010 15:32
async test sucks.
var testDbCardStoragePutSouldCount = function() {
doTestDbCardStorage(
"test1",
function(done, target) {
target.count(
function(cnt) {
assertEquals(0, cnt);
target.put(
tfil.test.HELLO_CARD_RECORD,
function() {