Skip to content

Instantly share code, notes, and snippets.

View gregglind's full-sized avatar

Gregg Lind gregglind

View GitHub Profile
@camsjams
camsjams / guide.md
Last active May 1, 2022 16:21
How to upgrade a Node JS Express project using Swagger-Express

How to upgrade a Node JS Express project using Swagger

Migrate [swagger-express-mw] / and underlying [swagger-node-runner] to [express-openapi]

Intro

Why do this?

There have been a number of high and critical vulnerabilities caused by the npm package.

I myself have been hunting through ways to figure out how to solve these problems, as the package maintainers seem to have abandonded this library (there was even an NPM fork which still seems to have issues with bagpipes - see [swagger-node-runner year old PR]). I have created a basic guide to help others out, so that I am not just another DenverCoder9 (https://xkcd.com/979/)

[npm audit] and [snyk] scans find issues like:

@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
@gregglind
gregglind / para.tags.all.ids.txt
Last active August 29, 2015 14:08
Idea for making all ids on a reports page have a para link.
/** js **/
/** or this could be in the page template, if adding an 'a' there is easier **/
/* 'after' was chosen for laziness/simplicity of styling. */
/* if you to get *all things with ids
$(".content").find("p, ul, ol, pre, h1, h2, h3, h4, h5, h6") # more restrictive
*/
$(".content").find("*").each( function (k, v) {
var id = v.id;
#! /usr/bin/python
# coding=utf-8
import cgi
import cgitb
cgitb.enable()
from datetime import datetime, timedelta
import json
import os
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@rtucker-mozilla
rtucker-mozilla / gist:11186162
Created April 22, 2014 16:44
Loop iteration over an array in surveygizmo syntax
%%pageid = 1;
%%errormsg_qid = 6;
%%completed_percent = 0;
%%slider_array = array(4,7,21,22,23,24,25,26);
foreach(%%slider_array as %%slider_id){
%%completed_percent = %%completed_percent + sgapiGetValue(%%slider_id);
}
if (%%completed_percent != 100){
sgapiHideQuestion(%%errormsg_qid,false);
@ZER0
ZER0 / gist:10024431
Created April 7, 2014 17:19
Add-on SDK: to Certificate Viewer window
let { events: windowEvents } = require('sdk/window/events');
let { on } = require('sdk/event/core');
let { filter } = require('sdk/event/utils');
let ready = filter(windowEvents, ({type}) => type === 'DOMContentLoaded');
let certificateWindows = filter(ready, ({target}) =>
target.document.documentElement.mozMatchesSelector('dialog#certDetails'));
on(certificateWindows, 'data', ({target: window}) => {
@Noitidart
Noitidart / _template-BootstrapJSM.xpi
Last active July 22, 2018 03:30
ff-addon-template: Template for how to create a JSM module.
@caged
caged / d3-server.js
Last active October 17, 2023 04:05
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
"use strict";
let recorder=require("micropilot").Micropilot("addressbar").start();
let possibles = [
"where to do today?",
"search or enter an address",
"your wish is my command"
];