Skip to content

Instantly share code, notes, and snippets.

View bmartin2015's full-sized avatar

Ben Martin bmartin2015

View GitHub Profile
@josh-padnick
josh-padnick / README.md
Last active March 16, 2024 15:19
Manually Edit AWS Console "Switch Role" Configuration in Bash

Manually Edit AWS Console "Switch Role" Configuration in Bash

Motivation

At Gruntwork, we work with multiple software teams. That means we have to modify the "Switch Role" history multiple times. But the only way to do that today is to delete your cookie and clear all AWS Console saved settings. That got old after a while, so these instructions enable you to modify the "Switch Roles" configuration directly.

The Big Picture

@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active May 17, 2024 12:59
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@brianmriley
brianmriley / string-dot-notation-to-object
Last active April 9, 2024 16:23
Convert Javascript string in dot notation into an object reference
// pulled from SO http://stackoverflow.com/questions/6393943/convert-javascript-string-in-dot-notation-into-an-object-reference
// NOTE: Array.reduce() may not be available in older browsers
function index(obj,i) {return obj[i]}
'a.b.etc'.split('.').reduce(index, obj);
var obj = {a:{b:{etc:5}}};
index(obj,'a.b.etc');