Skip to content

Instantly share code, notes, and snippets.

View Aaronius's full-sized avatar

Aaron Hardy Aaronius

View GitHub Profile
@Aaronius
Aaronius / debug.txt
Created August 21, 2022 04:41
Terraform CDK debug output
➜ cdktf git:(master) ✗ CDKTF_LOG_LEVEL=debug cdktf synth
[2022-08-20T22:40:57.697] [DEBUG] default - Error reporting disabled
[2022-08-20T22:40:57.710] [DEBUG] default - {
"terraform_version": "1.2.7",
"platform": "darwin_arm64",
"provider_selections": {},
"terraform_outdated": false
}
[2022-08-20T22:40:57.711] [DEBUG] default - {
@Aaronius
Aaronius / CombineObjectsFromUnion.ts
Last active June 28, 2022 09:52
CombineObjectsFromTuple
type Combine<A, B> = Omit<A, keyof B> &
Omit<B, keyof A> & { [K in keyof A & keyof B]: A[K] | B[K] };
type CombineObjectsFromTuple<T> = T extends [infer K, ...infer R]
? Combine<K, CombineObjectsFromUnion<R>>
: T;
@Aaronius
Aaronius / blackbird.js
Created January 28, 2021 17:10
Blackbird Mini SDK (WIP)
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
@Aaronius
Aaronius / debuggere2esetup.js
Created January 26, 2021 23:23
Setting up launch properties and edge configurations for Debugger e2e tests
async function setUpEdgeConfigurationAndEnvironment({ blackbird }) {
console.log('Creating edge configuration.');
const config = await blackbird.createConfig({
description: 'Dummy from test',
enabled: true,
title: `Debugger E2E Test Config ${uuid()}`,
type: ''
});
const environment = await blackbird.createEnvironment(config.id, {
type: 'development',
@Aaronius
Aaronius / memoize1.js
Last active September 13, 2019 21:15
Memoize
const getCommaDelimitedKeys = memoize(object => {
return Object.keys(object).join(",");
});
const fruits = {
apple: 95,
avocado: 234,
banana: 133
};
@Aaronius
Aaronius / gist:09f1b3168a99357ebda2c7fee6447bde
Created January 23, 2019 02:57
Example upload npm script
{
"name": "reactor-helloworld-extension",
"version": "1.0.0",
"scripts": {
"upload": "npx @adobe/reactor-uploader --environment=production --org-id=04B20B885A7B43080A494209@AdobeOrg --tech-account-id=94A538A75B180FC90A49410B@techacct.adobe.com --api-key=395fe521b0044160935a90db77e0e18b"
}
}
@Aaronius
Aaronius / hyper.js
Last active April 26, 2018 04:06
hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@Aaronius
Aaronius / stopport.sh
Created March 17, 2017 15:37
Kills a port. Put it in /usr/local/bin. Run it like so: `stopport 3000`
#!/bin/bash
lsof -i tcp:$1 | awk 'NR!=1 {print $2}' | xargs kill
@Aaronius
Aaronius / introrx.md
Last active August 29, 2015 14:12 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and netver tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

angular.module('qAllSettled', []).config(function($provide) {
$provide.decorator('$q', function($delegate) {
var $q = $delegate;
$q.allSettled = function(promises) {
return $q.all(promises.map(function(promise) {
return promise.then(function(value) {
return { state: 'fulfilled', value: value };
}, function(reason) {
return { state: 'rejected', reason: reason };
});