Skip to content

Instantly share code, notes, and snippets.

View mark-buhagiar's full-sized avatar

Mark Buhagiar mark-buhagiar

View GitHub Profile
@mark-buhagiar
mark-buhagiar / index.js
Last active October 12, 2016 20:58
Sample Nodejs app which uses letsencrypt-express for HTTPS
'use strict';
var lex = require('letsencrypt-express').create({
// NOTE, server should be set to 'staging' while testing
server: 'https://acme-v01.api.letsencrypt.org/directory'
, challenges: { 'tls-sni-01': require('le-challenge-sni').create({ webrootPath: '/tmp/acme-challenges' }) }
, challengeType: 'tls-sni-01'
, store: require('le-store-certbot').create({ webrootPath: '/tmp/acme-challenges' })
, approveDomains: approveDomains
});
@mark-buhagiar
mark-buhagiar / ExpandPathInObject.tsx
Created April 27, 2020 11:53
Expand path in object
export class ExpandFieldException extends Error {}
function expandPath(item: any, path: string): string {
var selectionRegex = /(^|\?|\.)(.+?)(?=(\?|\.|$))/g
var filterRegex = /(.+)=\((.+)\)/
const getItemProperty = (item: any, propertyName: string) => {
if (!item || !Object.keys(item).includes(propertyName))
throw new ExpandFieldException(path)