Skip to content

Instantly share code, notes, and snippets.

🇩🇰
In Denmark

Bret Comnes bcomnes

🇩🇰
In Denmark
Block or report user

Report or block bcomnes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View get-form-values.js
function getFormValues (formEl) {
return Array.from(new window.FormData(formEl).entries())
.reduce(function (obj, [key, value]) {
obj[key] = value
return obj
}, {})
}
@bcomnes
bcomnes / Tron Legacy.terminal
Last active May 28, 2019
Tron Legacy Terminal Profile
View Tron Legacy.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjEwOTA5NTk4MjEgMC4xMDkwOTU5ODIxIDAuMTA5MDk1OTgyMQAQAYAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
@bcomnes
bcomnes / README.md
Last active Feb 28, 2019
go-swagger bug
View README.md

A possible go-swagger bug

The request object that github.com/go-openapi/runtime implements has a .GetBody method. When you run the .GetBody method, it writes the ClientRequestWriterFunc to the req.Body again.

usage

With Go 1.12 installed:

View promise-backoff.js
var pause = (duration) => new Promise(res => setTimeout(res, duration));
var exponentialBackoff = (func, attempts = 1, delay = 50) => {
console.log('attempts', attempts)
return func().catch(err => {
console.log('error', err)
if (attempts > 1) {
console.log(`Retries left ${attempts - 1}`)
console.log(`Next delay ${delay * 2}`)
return pause(delay).then(() => exponentialBackoff(func, attempts - 1, delay * 2))
@bcomnes
bcomnes / Jenkinsfile
Created Dec 8, 2018
Git env vars you might need in jenkins
View Jenkinsfile
/*
Jenkins ENV Reference:
env.GIT_COMMIT: the commit sha of the current build
env.BRANCH_NAME: the branch name OR tag name of the current build, when it exists
env.GIT_BRANCH: same as BRANCH_NAME
env.TAG_NAME: the tag name of the current build, when it exists
*/
View .gitignore
node_modules
coverage
.nyc_output
@bcomnes
bcomnes / launch.json5
Last active Mar 11, 2018
How to set up vs code debugger with a run script
View launch.json5
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-support-for-npm-and-other-tools
"version": "0.2.0",
"configurations": [
{
"name": "Launch via test NPM",
"type": "node",
View gist:12d7bb78088159dee24a642c8a96bb6f

Epistle 3

I hope this letter finds you well. I can hear your complaint already, “Gordon Freeman, we have not heard from you in ages!” Well, if you care to hear excuses, I have plenty, the greatest of them being I’ve been in other dimensions and whatnot, unable to reach you by the usual means. This was the case until eighteen months ago, when I experienced a critical change in my circumstances, and was redeposited on these shores. In the time since, I have been able to think occasionally about how best to describe the intervening years, my years of silence. I do first apologize for the wait, and that done, hasten to finally explain (albeit briefly, quickly, and in very little detail) events following those described in my previous game (referred to herewith as Episode 2).

To

@bcomnes
bcomnes / idb-dat-storage.js
Created Jan 18, 2018 — forked from creationix/idb-dat-storage.js
A simple abstract-random-access implementation using indexed DB that takes advantage of hypercore's behavior or consistent boundaries/offsets.
View idb-dat-storage.js
/* eslint-env browser */
var Buffer = require('buffer').Buffer
var name = 'dat'
function withStore (type, block, callback) {
var req = indexedDB.open(name + '-db', 1)
req.onerror = () => callback(req.error)
req.onupgradeneeded = () => req.result.createObjectStore(name)
req.onsuccess = () => {
You can’t perform that action at this time.