Skip to content

Instantly share code, notes, and snippets.

View trieloff's full-sized avatar
🏠
Working from home

Lars Trieloff trieloff

🏠
Working from home
View GitHub Profile
@trieloff
trieloff / index.js
Last active July 28, 2021 14:36
Rewrite Cloudflare Log JSON before sending it to Coralogix
/**
* AWS S3 Lambda function for Coralogix
*
* @file https://gist.github.com/trieloff/1219ec5ec2f3ff42cad4b3f3ced5a429
* @author Coralogix Ltd. <info@coralogix.com>
* @link https://coralogix.com/
* @copyright Coralogix Ltd.
* @licence Apache-2.0
* @version 1.0.8
* @since 1.0.0
/* eslint-env mocha */
const sinon = require('sinon');
const proxyquire = require('proxyquire');
const assert = require('assert');
const { functionundertest } = require('../index');
describe('Testing Errors caused by HTTP Response', () => {
let functionundertest;
@trieloff
trieloff / test.js
Last active February 13, 2019 07:51
/* eslint-env mocha */
const nock = require('nock');
const assert = require('assert');
const { AssertionError } = require('assert');
const { functionundertest } = require('../index');
describe('Testing Errors caused by HTTP Response', () => {
let scope;
/* eslint-env mocha */
const assert = require('assert');
const { AssertionError } = require('assert');
const { functionundertest } = require('../index');
describe('Testing Error States', () => {
it('Throws an error when called with missing arguments', () => {
try {
{
"scripts": {
"test": "nyc --reporter=text --reporter=lcov --check-coverage --branches 100 --statements 100 --lines 100 mocha",
},
"devDependencies": {
"mocha": "^5.2.0",
"nyc": "^13.1.0",
}
}
xerslein
Großwagen
Neuerbech
Däffald
Miedershagstedd
Berower
Redem
Ettenfulder
Meberstorf
Geitzermorcht
Aach
Aachen
Aalen
Aarbergen
Aasbüttel
Abbau Ader
Abbendorf
Abbenrode
Abberode
@trieloff
trieloff / test.js
Created May 7, 2017 16:32
Test script to run OpenWhisk functions locally
process.stdin.setEncoding('utf8');
if (process.argv[2]=="--help"||process.argv[2]=="-h") {
help();
} else if (!process.stdin.isTTY) {
var input = "";
process.stdin.on('readable', () => {
var chunk = process.stdin.read();
if (chunk !== null) {
@trieloff
trieloff / component_with_policy.jsp
Created April 11, 2017 10:28
Getting a content policy's property in JSP
<%@include file="/libs/foundation/global.jsp"%><%
String[] whitelist = currentStyle.get("allowedSites", new String[0]);
%>
@trieloff
trieloff / design_dialog.xml
Created April 11, 2017 10:24
Defining a simple design dialog for configuring a component's content policies
<cq:design_dialog jcr:primaryType="nt:unstructured" jcr:title="Embed" sling:resourceType="cq/gui/components/authoring/dialog" jcr:description="Content policy for embedding content">
<content jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<tabs jcr:primaryType="nt:unstructured" maximized="true" sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured" jcr:title="Main" margin="true" sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<content jcr:primaryType="nt:unstructured" margin="false" sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<allowedSites jcr:primaryType="nt:unstructured" fieldDescription="I