Skip to content

Instantly share code, notes, and snippets.

View jkonowitch's full-sized avatar

Jeffrey Konowitch jkonowitch

  • New York
View GitHub Profile
@m5r
m5r / index.tsx
Created February 26, 2022 20:22
bullmq job queue in Remix
import notifierQueue from "~/queues/notifier.server.ts";
export const loader = async () => {
await notifierQueue.add("test", { emailAddress: "mokhtar@remixtape.dev" });
return null;
};
@pkcpkc
pkcpkc / tableOfContents.js
Last active December 22, 2023 20:27
JavaScript: HTML heading Table of Contents: Generate a navigatable, stylable table of contents based on the heading structure of an html document
/*
Collect headers (h1, h2, ..., hx) from html and generates navigatable, stylable table of contents.
@param maxHeaderLevel int Define header level depth, defaults to 3.
@param styleItem function Function that accepts text:string, level:int and itemAnchor:string to style toc entry, default renderer is set already (check source for usage).
@return string HTML table of contents
*/
function generateTableOfContents(maxHeaderLevel = 3, styleItem = function (text, level, itemAnchor) {
var spaces = " ".repeat(Math.max(0, (level - 1)) * 3);
var tocEntry = spaces + '<a href="#' + itemAnchor + '">' + text + '</a><br/>';
@vojtajina
vojtajina / e2e-tests.js
Created February 15, 2012 23:41
Angular: Scenario runner explanation
// simple dsl just wrapping angular's dsl, just providing higher abstraction
angular.scenario.dsl('submitMessage', function() {
return function(message) {
// these dsl already register futures (add fn into the queue),
// so you don't wrap them into addFutureAction
input('modelValue').enter(message);
element('button.submit').click();
};
});