Skip to content

Instantly share code, notes, and snippets.

@cuperman
cuperman / aws_instance_scheduler.md
Last active Feb 27, 2020
AWS Instance Scheduler
View aws_instance_scheduler.md
@cuperman
cuperman / BaseStack.ts
Created Jan 30, 2020
Using Tag Manager
View BaseStack.ts
import { StackProps, Stack, Construct, Tag } from '@aws-cdk/core'
export class BaseStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
const { tags } = props;
// Make sure everything is tagged
Object.entries(tags).forEach(([name, value]) => {
@cuperman
cuperman / cors_handler.js
Created Dec 28, 2017
Supporting CORS using SAM
View cors_handler.js
// cors_handler.js
const ALLOW_HEADERS = [
'Content-Type',
'X-Amz-Date',
'Authorization',
'X-Api-Key',
'X-Amz-Security-Token'
];
@cuperman
cuperman / bind_all_methods.js
Last active Nov 14, 2017
Bind methods to this
View bind_all_methods.js
// Usage:
//
// import bindAllMethods from 'bind_all_methods';
// import React from 'react';
//
// class MyComponent extends bindAllMethods(React.Component) {
// ...
// }
//
export default function bindAllMethods(BaseComponent) {
View lambdaExplorer.js
'use strict';
exports.handler = (event, context, callback) => {
callback(null, {
statusCode: 200,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: event,
@cuperman
cuperman / .gitconfig
Last active Oct 24, 2017
git alias: add no whitespace
View .gitconfig
[alias]
addnw = !bash -c 'git diff -U0 -w --no-color $@ | git apply --cached --ignore-whitespace --unidiff-zero -'