- varnish-cache: https://github.com/varnishcache/varnish-cache
- memcached: https://github.com/memcached/memcached
- beanstalkd: https://github.com/kr/beanstalkd
- kafka: http://kafka.apache.org/
'use strict'; | |
const async = require('async'); | |
const Promise = require('bluebird'); | |
const db = { | |
app: [ | |
{ id: 10, name: 'twitter' }, | |
{ id: 11, name: 'facebook' }, | |
{ id: 12, name: 'google' } |
package com.test; | |
import java.util.Random; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class AsyncFuture { | |
public static void main(String[] args) { | |
ExecutorService service = Executors.newFixedThreadPool(5); |
function run(generator) { | |
var it = generator(); | |
var obj = it.next(); | |
(function _run() { | |
if (!obj.done) { | |
obj.value.then(result => { | |
obj = it.next(result); | |
_run(); | |
}).catch(err => it.throw(err)); |
// Make sure that unsigned long is 8 bytes of length | |
unsigned long utilDoubleToLong(double value) { | |
unsigned long longValue; | |
memcpy(&longValue, &value, sizeof(unsigned long)); | |
return longValue; | |
} | |
double utilLongToDouble(unsigned long value) { | |
double doubleValue; |
// Working with elasticsearch client 12.1.0 | |
var elasticsearch = require('elasticsearch'); | |
var client = new elasticsearch.Client({ | |
host: '127.0.0.1:9200', | |
log: 'warning' | |
}); | |
// Override per default deserialize method without JSON.parse() | |
client.transport.serializer.deserialize = function (str) { |
# | |
# Compiler flags | |
# | |
CC = gcc | |
CFLAGS = -Wall -Werror -Wextra | |
# | |
# Project files | |
# | |
SOURCES = file1.c file2.c file3.c file4.c |
'use strict'; | |
var INITIAL_CAPACITY = 16; | |
/** | |
* @param {Array|Number} arg Content or initial capacity. | |
*/ | |
function ArrayDeque(arg) { | |
this._elements = new Array(typeof arg === 'number' ? | |
this._nextHighestPowerOfTwo(arg) : Array.isArray(arg) ? |
/** | |
* Fast UUID generator, RFC4122 version 4 compliant. | |
* @author Jeff Ward (jcward.com). | |
* @license MIT license | |
* @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 | |
**/ | |
var UUID = (function() { | |
var self = {}; | |
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); } | |
self.generate = function() { |