Skip to content

Instantly share code, notes, and snippets.

/// <reference types="node" />
import { BinaryToTextEncoding } from 'crypto';
export declare const createSHA256Hash: (input: string | Buffer, outputEncoding?: BinaryToTextEncoding) => string;
export declare interface Pkcs12ReadResult {
ca?: string[];
cert?: string;
key?: string;

Keybase proof

I hereby claim:

  • I am spalger on github.
  • I am spalger (https://keybase.io/spalger) on keybase.
  • I have a public key ASB0-Lj2AI2heAgEQ4V2Yexi65Wx3hez0Y2zApAMZIcQXQo

To claim this, I am signing this object:

[management] is importing from legacy code:
request: ../../../../legacy/ui/public/indexed_array
from: src/plugins/management/public/legacy/section.js
resolved to: src/legacy/ui/public/indexed_array/index.js
[bfetchExplorer] is importing from legacy code:
request: ../../../../legacy/core_plugins/visualizations/public/embeddable/constants
from: src/plugins/kibana_react/public/saved_objects/saved_object_save_modal.tsx
resolved to: src/legacy/core_plugins/visualizations/public/embeddable/constants.ts
@spalger
spalger / .js
Created October 18, 2016 21:14
const get = require('lodash.get')
const vars = { first: 'spencer', last: 'alger', age: 28 }
return 'Mr. { first } {last }, age {age}'.replace(/\{\s*(.+?)\s*\}/g, (_, name) => get(vars, name))
@spalger
spalger / eswait.js
Last active April 11, 2016 21:19 — forked from rrva/eswait.js
(function checkForConnection() {
esClient.ping(function (err, pong) {
if (pong) {
console.log("Ping got pong!");
} else {
console.log("Ping did not get pong, trying again in 3sec.");
setTimeout(checkForConnection, 3000);
}
})
}());
@spalger
spalger / partial.js
Created February 8, 2016 08:31
A version of _.partial that caches functions so that `partial(fn, 1, 2, 3) === partial(fn, 1, 2, 3)`.
var partial = (function () {
'use strict';
const caches = new WeakMap()
return function partial(fn, ...args) {
let toApply = fn
while (args.length) {
if (!caches.has(toApply)) caches.set(toApply, [])
/*
* SystemJS v0.19.17
*/
!function(){function e(){!function(e){function t(e,t){var n;return e instanceof Error?(n=new Error(e.message,e.fileName,e.lineNumber),M?(n.message=e.message+"\n "+t,n.stack=e.stack):(n.message=e.message,n.stack=e.stack+"\n "+t)):n=e+"\n "+t,n}function n(e,n,r){try{new Function(e).call(r)}catch(a){throw t(a,"Evaluating "+n)}}function r(){}function a(t){this._loader={loaderObj:this,loads:[],modules:{},importPromises:{},moduleRecords:{}},z(this,"global",{get:function(){return e}})}function o(){a.call(this),this.paths={}}function s(e,t){var n,r="",a=0;for(var o in e){var s=o.split("*");if(s.length>2)throw new TypeError("Only one wildcard in a path is permitted");if(1==s.length){if(t==o)return e[o];if(t.substr(0,o.length-1)==o.substr(0,o.length-1)&&(t.length<o.length||t[o.length-1]==o[o.length-1])&&"/"==e[o][e[o].length-1])return e[o].substr(0,e[o].length-1)+(t.length>o.length?"/"+t.substr(o.length):"")}else{var i=s[0].length;i>=a&&t.substr(0,s[0].length)==s[0]&&t.substr(t.length-s[1].l
@spalger
spalger / gulpfile.babel.js
Last active January 25, 2016 00:10
babel transform that unlinks deleted/renamed files
import gulp from 'gulp'
import babel from 'gulp-babel'
import combiner from 'stream-combiner2'
import sourcemaps from 'gulp-sourcemaps'
import watch from 'gulp-watch'
import gulpif from 'gulp-if'
import del from 'del'
import vinylPaths from 'vinyl-paths'
gulp.task('default', function () {
#!/usr/bin/env bash
# call this with the pr number you want to apply and the base branch of that pr
#
# backport pr 5805, which was submitted against master, to 4.4:
# git co 4.4
# git cherry-pick-pr 5805
#
# backport pr 5840, which was submitted against 4.x, to 4.4:
# git co 4.4
@spalger
spalger / patch_sonarr.sh
Last active November 14, 2015 21:54
Patch Sonarr static files so that they load properly on iOS, which interestingly loads the templates file for both the runtime and the templates...
#!/usr/bin/env bash
set -e
cd ~/apps/NzbDrone/UI;
all="handlebars.combined.js"
runtime="handlebars.runtime.js"
tmpl="templates.js"
#####