Skip to content

Instantly share code, notes, and snippets.

@igorkosta
igorkosta / sreda.test.js
Last active December 4, 2020 14:25
Mock promisified AWS service operation calls
/* eslint-env jest */
'use strict'
const { read, keys } = require('../sreda')
const AWS = require('aws-sdk')
let ssm = new AWS.SSM()
var ssmPromise = {
promise: jest.fn().mockImplementation((request) => {
return new Promise((resolve, reject) => {
@aackerman
aackerman / gist:93d86b780ef7e951b59351dcc99af1b1
Last active April 15, 2021 07:45
Parameter Store Config
'use strict'
const EventEmitter = require('events')
// default expiry 3 mins
const DEFAULT_EXPIRY = 3 * 60 * 1000
const create = ({ keys, ssm, keyPrefix = '', expiryMs = DEFAULT_EXPIRY }) => {
let isRefreshing = false
if (!keys || !Array.isArray(keys) || keys.length === 0) {
throw new Error('Provide a non-empty array of config keys')
@igorkosta
igorkosta / request.js
Created December 22, 2017 10:36 — forked from sheharyarn/request.js
Axios Request Wrapper for React
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@igorkosta
igorkosta / deploy.sh
Last active November 19, 2017 20:44
Deploy gzip-ped `vuejs` to S3
#!/bin/bash
# make file executable
set -e
instructions ()
{
echo "*********************************************"
echo "Run this script as an npm task *"
echo "$ npm run deploy <env> *"
@Geoff-Ford
Geoff-Ford / composing-software.md
Last active September 12, 2024 18:03
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

'use strict';
const co = require('co');
const EventEmitter = require('events');
const Promise = require('bluebird');
const AWS = require('aws-sdk');
const ssm = Promise.promisifyAll(new AWS.SSM());
const DEFAULT_EXPIRY = 3 * 60 * 1000; // default expiry is 3 mins
@singledigit
singledigit / cognito.yaml
Last active August 14, 2024 09:14
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
const state = {
now: new Date
}
const actions = {
start ({ commit }) {
setInterval(() => {
commit('updateTime')
}, 1000 * 60)
}
@igorkosta
igorkosta / mssql.md
Last active March 1, 2017 14:09
MSSQL in docker on an older Mac

MSSQL on a Mac

Older Macs (e.g. MacBook late 2008)

Prerequisite: VirtualBox. Grab your copy here: https://www.virtualbox.org/wiki/Downloads

Official docker app is not running on the older Macs but we still can make MSSQL run on those machines and that's fucking awesome. Firs of all we have to install boot2docker

@brenopolanski
brenopolanski / npm-list-globally.md
Created November 1, 2016 19:34
Listing globally installed NPM packages and version
npm list -g --depth=0