Skip to content

Instantly share code, notes, and snippets.

View gregglind's full-sized avatar

Gregg Lind gregglind

View GitHub Profile
@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);
@staltz
staltz / introrx.md
Last active May 9, 2025 12:50
The introduction to Reactive Programming you've been missing
#! /usr/bin/python
# coding=utf-8
import cgi
import cgitb
cgitb.enable()
from datetime import datetime, timedelta
import json
import os
@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;
@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())
@CoolOppo
CoolOppo / Cargo.toml
Last active September 15, 2024 10:55
How to compile to a DLL in rust while using it as a normal rust library
[package]
name = "test"
version = "0.1.0"
authors = ["YOU <[email protected]>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
@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:

@pesterhazy
pesterhazy / memorable-uuids.md
Last active April 1, 2025 16:55
A UUID to remember

In their most used version v4, UUIDs are random, and that's a useful property. But sometimes all you want is a UUID that is easy to remember. To hell with randomness!

A minor complication is that for a string to parse as a valid UUID, the variant and version bits should be set correctly (to 2 and 4, respectively). Here are a few suggestions that pass the test:

facade00-0000-4000-a000-000000000000
decade00-0000-4000-a000-000000000000