Skip to content

Instantly share code, notes, and snippets.

View loganpowell's full-sized avatar

Logan Powell loganpowell

  • Metro DC
View GitHub Profile
@loganpowell
loganpowell / redis_streams_w_ioredis.js
Created March 27, 2020 19:49 — forked from forkfork/ioredis_example.js
Example of using Redis Streams with Javascript/ioredis
var Redis = require('ioredis');
var redis = new Redis({
host: "nodesydney.wiftycloud.com",
password: "7884b8baaa49fbcb48f17ad2a146"
});
async function main() {
// write an event to stream 'events', setting 'key1' to 'value1'
await redis.sendCommand(
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content-Security-Policy</title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' data: gap: 'unsafe-eval' ws: ;
style-src 'self' 'unsafe-inline';
script-src https: *.example.com ;
@loganpowell
loganpowell / GFM.md
Created January 23, 2020 03:32
GFM example

Features

  • Support Standard Markdown / CommonMark and GFM(GitHub Flavored Markdown);
  • Full-featured: Real-time Preview, Image (cross-domain) upload, Preformatted text/Code blocks/Tables insert, Code fold, Search replace, Read only, Themes, Multi-languages, L18n, HTML entities, Code syntax highlighting...;
  • Markdown Extras : Support ToC (Table of Contents), Emoji, Task lists, @Links...;
  • Compatible with all major browsers (IE8+), compatible Zepto.js and iPad;
  • Support identification, interpretation, fliter of the HTML tags;
  • Support TeX (LaTeX expressions, Based on KaTeX), Flowchart and Sequence Diagram of Markdown extended syntax;
  • Support AMD/CMD (Require.js & Sea.js) Module Loader, and Custom/define editor plugins;
@loganpowell
loganpowell / package.json
Created January 20, 2020 00:11 — forked from adamreisnz/package.json
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@loganpowell
loganpowell / hdom_local_state_cycle.js
Last active January 13, 2020 13:40
HDOM with lifecycle and local state
/*
NOTES:
- source: https://github.com/thi-ng/umbrella/blob/develop/examples/hdom-local-render/src/index.ts
- demo: https://demo.thi.ng/umbrella/hdom-local-render/
- docs on lifecycle: https://github.com/thi-ng/umbrella/tree/master/packages/hdom#component-objects-with-life-cycle-methods
- docs on state MGMT/HOF components: https://github.com/thi-ng/umbrella/wiki/Higher-order-components
*/
import { DEFAULT_IMPL, normalizeTree, replaceChild } from "@thi.ng/hdom";
import { memoize1 } from "@thi.ng/memoize";
@loganpowell
loganpowell / jsdoc-templates-config-windows.md
Last active December 22, 2019 19:05
JSDoc Templates on Windows

JSDocs doc... (meta)

Installation

Recommended: Install as a -D devdependency

npm i -D jsdoc
@loganpowell
loganpowell / cmder-aliases.txt
Created October 16, 2019 14:49
Cmder Aliases
clear=cls
grep=grep -nRi $*
ga=git add -A $*
gac=git add -A :/ $T git commit -e
gacm=git add -A :/ $T git commit -m $*
gau=git add -u
gb=git branch -v $*
@loganpowell
loganpowell / tail-call-optimization-hack.js
Last active October 4, 2019 14:18 — forked from Gozala/example.js
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@loganpowell
loganpowell / index.html
Created September 6, 2019 14:18 — forked from nolanlawson/index.html
Web Worker via blob URL
<!doctype html>
<html lang="en">
<body>
<span id="output"></span>
</body>
<script>
(function () {
var workerBlob = new Blob(
[workerRunner.toString().replace(/^function .+\{?|\}$/g, '')],
{ type:'text/javascript' }
@loganpowell
loganpowell / aws-couchdb-setup.md
Created August 18, 2019 09:50 — forked from Ravenstine/aws-couchdb-setup.md
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new