Skip to content

Instantly share code, notes, and snippets.

View zserge's full-sized avatar

Serge Zaitsev zserge

View GitHub Profile
package trikita.anvil.demo;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner;
package trikita.anvil.demo;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner;
@zserge
zserge / B.java
Created October 5, 2014 15:04
Tiny benchmark class
/** A tiny benchmark class */
public static class B {
private int count = 0;
private long start;
private long end;
private long min = Long.MAX_VALUE;
private long max;
private String label;
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
--
-- Let you write code like
-- chain(func1):next(func2):next(func3):go()
--
function chain(cb)
local queue = {}
local n, go;
go = function()
local cb = table.remove(queue, 1)
@zserge
zserge / chain.js
Created October 17, 2013 09:04
Extemely minimalistic implementation of promises/futures
function chain(callback) {
var queue = [];
function _next() {
var cb = queue.shift();
if (cb) {
cb(_next);
}
}
diff --git a/lposix.c b/lposix.c
index 03dcbe8..e0bd25c 100644
--- a/lposix.c
+++ b/lposix.c
@@ -34,6 +34,8 @@
#include <time.h>
#include <unistd.h>
#include <utime.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
// ==UserScript==
// @match http://developer.android.com/*
// ==/UserScript==
var elem = document.getElementById('search-container');
document.addEventListener("keypress", function(e) {
if (e.which == 47) { // '/', like in vim
if (document.createEvent) {
var ev = document.createEvent('MouseEvents');