Skip to content

Instantly share code, notes, and snippets.

@DaRaFF
DaRaFF / flag_controller.js
Last active November 26, 2022 17:19
Flags Example
// server
module.exports = function (flagsApi) {
return {
index: function (req, res, next) {
const channelId = getChannelId(req)
if (!channelId) return res.error(400, {channel_id: 'missing mandatory parameter'})
flagsApi.list(channelId, function (err, flags) {
if (err) return res.error(err)
res.success({flags})
@DaRaFF
DaRaFF / ld-discussion.md
Last active July 3, 2020 11:31
Editor Config Access / Expose Infos

Expose a li object on window

  • throw events when ready
  • more simple access
  • better for testability
window.li = {
  session,
  contentBehavior,
 projectBehavior,
#!/bin/bash
DESIGNNAME=${4:-"living-times"}
DESIGNVERSION=${5:-"1.0.2"}
echo "-------ARGUMENTS-------------"
echo "Generate documentId from: $1"
echo "Generate documentId to: $2"
echo "Title postfix: $3"
echo "Design name $DESIGNNAME"
@DaRaFF
DaRaFF / categories.json
Last active March 19, 2020 09:01
data sources
{
"categories": [
{"id": "1", "category": "Bücher"},
{"id": "2", "category": "News"},
{"id": "3", "category": "Wirtschaft"},
{"id": "4", "category": "International"},
{"id": "5", "category": "Weiteres"}
]
}
http://bluewin.sta.sctv.ch/fr/videos.html
https://bluewin.sta.sctv.ch/de/index.html
https://bluewin.sta.sctv.ch/fr/index.html
https://bluewin.sta.sctv.ch/it/index.html
http://bluewin.sta.sctv.ch/de/newsregional/zuerich/schweizer-wollte-wein-und-schusswaffe-nach-deutschland-schmuggeln-105903.html
http://bluewin.sta.sctv.ch/de/digital/tipps.html
http://bluewin.sta.sctv.ch/it/attualita/estero/spia-russa-esperto-teoria-valigia-e-idiota-107212.html
@DaRaFF
DaRaFF / better_search.js
Created April 11, 2019 09:44
Example of a better document search query for Livingdocs
const _ = require('lodash')
// Creates an Elasticsearch query
//
// Use multiplication to combine time and query score
// Add a minimum function_score for old documents, otherwise it would
// multiply with 0 after 1000 days of linear boost
//
// @param {String} searchQuery 'hello world'
// @returns {Object} Elasticsearch body.query
@DaRaFF
DaRaFF / get-first-livingdocs-server-docker-image-name.sh
Last active December 10, 2018 14:35
Get First Livingdocs Server Docker Image Name
#!/bin/bash
# ./get-first-livingdocs-server-docker-image-name.sh my-feature release-2018-11 master
# returns the first existing image on dockerhub e.g. 'release-2018-11'
TOKEN=$( curl -sSLd "username=${DOCKER_USERNAME}&password=${DOCKER_PASSWORD}" https://hub.docker.com/v2/users/login | jq -r ".token" )
for DOCKER_TAG in "$@";
do
IMAGE_TAG=$(curl -sH "Authorization: JWT $TOKEN" "https://hub.docker.com/v2/repositories/livingdocs/server/tags/${DOCKER_TAG}/" | jq 'select(.name != null)' | jq .name | cut -f2 -d$'"')
@DaRaFF
DaRaFF / README.md
Last active October 19, 2018 09:49
Creates a Downstream Integration Branch PR for Release Management of Livingdocs

Creates a new downstream integration PR

e.g. upstream-release-2018-08 against upstream-release-2018-06

Example

# GH_REPO_NAME e.g. livingdocs-bluewin-server
# GH_REPO_OWNER e.g. livingdocsIO
# GH_BRANCH_NAME e.g. upstream-release-2018-08 // pr will be created on this branch
# GH_BASE_BRANCH_NAME e.g. upstream-release-2018-06 // pr will be created against this branch
# RELEASE_NAME e.g. "September 2018"
@DaRaFF
DaRaFF / README.md
Last active October 19, 2018 09:51
Creates a Version Bump PR for Release Management of Livingdocs

Create a version bump PR

for release management of Livingdocs

Example

# GH_BUMP_TO e.g. v32.6.0
# GH_REPO_NAME e.g. livingdocs-editor
# GH_TOKEN e.g. 123f345f11234
@DaRaFF
DaRaFF / bluewin-staging-performance-test-2018-05-04
Created May 4, 2018 09:39
Bluewin Staging Performance Test 2018-05-04
-