Notice that java, elasticsearch and rabbitmq are already set up in my system.
{
"name": "logstash-server",
set = (v) -> (f) -> f(v) | |
get = (f) -> f (v) -> v | |
t = set(42) | |
get(t) // 42 |
module.exports = class Bundlr | |
FORMAT_TTNITF: 'ttnitf' | |
FORMAT_PICTURE: 'bild' # deliberate to match OFP | |
FORMAT_TTNINJS: 'ttninjs' | |
FORMAT_INDESIGN: 'indesign' | |
FORMAT_CUTPASTE: 'cutpaste' # txt-format in media-moj | |
FORMAT_TTNITFXML: 'ttnitfxml' | |
# ofp spec is "ttninf", "ttnintf+bild", "ttinjs" etc |
1970-01-01 behandlas som null | |
versioncreated = datum dokumentet skapas. (sdl fotodatum med tidsdel 00:00) | |
versionstored = indexeringsdatum. om vi är master, eget annars ta källan (sdl typ) | |
date = datum dokumentet gäller (t.ex. framtid för planering | |
eller framtid grafik, men fotodatum för sdl) | |
if tidsdel för date finns | |
datetime = samma logik som date men med tidsdel. annars null. |
# Goals | |
# | |
# 1. Mix promise and non-promise arguments | |
# 2. Behaves like a normal function if all arguments are non-promise | |
# 3. Returns a promise if any non-promise argument | |
# 4. Use no promise library, rely on the fact that: | |
# promise.then(-> a1).then((a2) -> a1 === a2) | |
# promise.then(-> Promise(a1)).then((a2) -> a1 === a2) | |
# |
Implemented in https://github.com/algesten/fnuc/blob/master/src/fnuc.coffee#L202
This example shows how plift
can help to treat functions dealing with promises as regular functions.
N.B. This code is a "handler" it is not intended to be side effect free.
userToDevices
is a function looking up devices from a user id in a database. It returns a promise for the result.web: node web.js |
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("") | |
base = alphabet.length | |
exports.encode = (i) -> | |
return alphabet[0] if i is 0 | |
s = "" | |
while i > 0 | |
s += alphabet[i % base] | |
i = parseInt(i / base, 10) |
private final static Similarity NO_LENGTH_SIMILARITY = new DefaultSimilarity() { | |
// we are interested in length norm for the street number field. | |
// it's good if 10 is sorted before 10a and 10b. | |
// | |
// the "country" field is very important it has no document boost since that means | |
// simply turning Query.setCountry() on will make a different score. This is because | |
// a document boost will add to every field and country is matched in a MUST. | |
@Override | |
public float computeNorm(String field, FieldInvertState state) { |