Skip to content

Instantly share code, notes, and snippets.

View clintandrewhall's full-sized avatar
⌨️
hacking away

Clint Andrew Hall clintandrewhall

⌨️
hacking away
View GitHub Profile
@clintandrewhall
clintandrewhall / use_undo_redo.ts
Created November 19, 2021 20:38
React Hook - undo/redo
import { useReducer, useCallback, Reducer } from 'react';
interface State<T = string> {
past: T[];
present: T;
future: T[];
}
interface Action<T> {
type: 'UNDO' | 'REDO' | 'SET' | 'CLEAR';
/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
* Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */
(window.canvas_bundle_jsonpfunction=window.canvas_bundle_jsonpfunction||[]).push([[5],{177:function(module,exports,__webpack_require__){"use strict";var memo,isOldIE=function(){return void 0===memo&&(memo=Boolean(window&&document&&document.all&&!window.atob)),memo},getTarget=function(){var memo={};return function(target){if(void 0===memo[target]){var styleTarget=document.querySelector(target);if(window.HTMLIFrameElement&&styleTarget instanceof window.HTMLIFrameElement)try{styleTarget=styleTarget.contentDocument.head}catch(e){styleTarget=null}memo[target]=styleTarget}return memo[target]}}(),stylesInDom=[];function getIndexByIdentifier(identifier){for(var result=-1,i=0;i<stylesInDom.length;i++)if(stylesInDom[i].identifier===identifier){result=i;break}return result}functi
@clintandrewhall
clintandrewhall / webpack.config.js
Created April 12, 2020 17:23
tiny-json-http/issues/14 example
const path = require('path');
const fs = require('fs');
const CopyPlugin = require('copy-webpack-plugin');
const lib = path.resolve(__dirname, 'lib/http');
const entry = {};
const copies = [];
const externals = { '@architect/functions': 'commonjs @architect/functions' };
fs.readdirSync(lib).forEach((mod) => {
@clintandrewhall
clintandrewhall / workpad.json
Last active July 3, 2019 17:00
Carousel using Markdown in Kibana Canvas
{
"css": ".canvasPage {\n\n}",
"id": "workpad-437c9656-65f8-4078-9569-a3fa6b53cdaf",
"name": "Carousel in Markdown",
"width": 1080,
"height": 720,
"page": 0,
"pages": [
{
"id": "page-b58842df-918e-4580-91fe-5890fa735703",
@clintandrewhall
clintandrewhall / node-and-npm-in-30-seconds.sh
Created November 7, 2011 20:29 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@clintandrewhall
clintandrewhall / gist:1210263
Created September 11, 2011 23:16
Winston configuration...?
var config = {
"levels" : {
"detail": 0,
"trace": 1,
"debug": 2,
"enter": 3,
"info": 4,
"warning": 5,
"error": 6
@clintandrewhall
clintandrewhall / MyTest
Created July 4, 2011 02:40
Learning code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>QnA</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>
<body>
<div id="container" class="clearfix">
@clintandrewhall
clintandrewhall / gist:1062714
Created July 3, 2011 23:43
Attempting to monitor existence of Redis in Connect/Express
// This just seems silly, honestly... and I'm concerned about my use of app.use
// over and over. :-/
// This var is only necessary b/c the connection to redis continues to be attempted
// if the error event is handled.
var redisConnected = false;
function redisConnect() {
if(!redisConnected) {
logger.warn("Redis Session store connected; applying session.");
/**
* @constructor
* @param {Object} config A valid configuration.
*/
var Photos = function(config) {
var core = require("./core")(config),
logger = require('log4js')(config.log4js).getLogger("node-foursquare.Photos");
/**
* Retrieve a photo from Foursquare.

Keybase proof

I hereby claim:

  • I am clintandrewhall on github.
  • I am clintandrewhall (https://keybase.io/clintandrewhall) on keybase.
  • I have a public key whose fingerprint is 3BCF 4721 5A0B 9CFE E2B2 4951 8916 FEB0 5981 1AEF

To claim this, I am signing this object: