Skip to content

Instantly share code, notes, and snippets.

View coagmano's full-sized avatar
🐛
Bug curator @ Arthropods, Insecta, & Hemiptera

Frederick Stark coagmano

🐛
Bug curator @ Arthropods, Insecta, & Hemiptera
  • Stark Enterprises
  • Sydney, Australia
  • 13:06 (UTC +10:00)
  • X @coagmano
View GitHub Profile
@coagmano
coagmano / roles_investigation.md
Created April 6, 2023 01:59 — forked from mooniker/roles_investigation.md
Roles and permissions system for Nodejs

ACL / Roles + Permissions

Virgen-ACL (virgen-acl)

  • https://github.com/djvirgen/virgen-acl
  • "Simple in-memory ACL for node.js apps. Supports arbitrary roles and resources, including role/resource detection using a simple interface. Additionally supports custom assertions for more complex rules."
  • Comments: "Simple and elegant, create your own checks. No middleware?"

Node ACL (acl) BuildStatusDependency StatusdevDependency Status

@coagmano
coagmano / transaction-utils.js
Last active July 1, 2020 00:36
Mongo Transaction Wrappers
async function commitWithRetry(session) {
try {
await session.commitTransaction();
} catch (error) {
if (
error.errorLabels &&
error.errorLabels.includes('UnknownTransactionCommitResult')
) {
log.error(
'UnknownTransactionCommitResult, retrying commit operation ...'
@coagmano
coagmano / animate.html
Last active March 8, 2021 04:37
Blaze animate HOC
{{> UI.ContentBlock }}
/**
* --- Continous Execution Library ---
*
* Copyright (c) 2013 Patrick Martinent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@coagmano
coagmano / gist:68ab7368948a23bca046fd0d2d48ae50
Created December 1, 2017 03:34
Node self-signed ssl test
2017-12-01 14:28:32 - 192-168-1-243 in ~/development/self-signed-ssl-cert-test
○ → node
> var fs = require('fs')
undefined
> var key = fs.readFileSync('server.key')
undefined
> var cert = fs.readFileSync('server.crt')
undefined
> var server = https.createServer({ key, cert })
undefined
@coagmano
coagmano / example.conf
Last active June 22, 2017 23:58
Example Nginx ssl terminator with proxy-pass to node app
server {
listen 443;
ssl on;
server_name EXAMPLE.com www.EXAMPLE.com;
access_log /var/log/nginx/EXAMPLE.com.access.log rt_cache;
error_log /var/log/nginx/EXAMPLE.com.error.log;
# SSL cert via letsencrypt
@coagmano
coagmano / gist:110d793c7bda2f2cae49e6b3bb395f55
Created January 8, 2017 23:46
BlockStack ID verification
Verifying that "coagmano.id" is my Blockstack ID. https://onename.com/coagmano
@coagmano
coagmano / gist:ea8176179cb7c831b9d762393b18cf77
Created January 8, 2017 23:26
Search NB pages bookmarklet
javascript:(function() {var query = window.prompt('Search term');if(query) {window.open('https://REPLACE_WITH_YOUR_SLUG.nationbuilder.com/admin/sites/1/pages/search?q='+query,'_blank');}})();
{% comment %}
/**
* This email template addon lets you calculate the donation ask amount based on
* previous history.
* Can be used unclosed to use default parameters:
* [ASK]
* Or supplied with parameters with a closing tag:
* [ASK]max|10|200|1.2[/ASK]
* - Parameters must be separated by a pipe '|'.
* - All parameters are optional and will revert to default if ommitted.
@coagmano
coagmano / nb-enlarge-preview.js
Created July 2, 2016 03:08
Enlarge the email preview windows on Nationbuilder
// ==UserScript==
// @name Enlarge NB preview
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Expands the email preview windows in Nationbuilder
// @author Fred Stark
// @match https://*.nationbuilder.com/admin/broadcasters/*/mailings/*/preview
// @grant none
// ==/UserScript==
/* jshint -W097 */