Skip to content

Instantly share code, notes, and snippets.

@d0ruk
d0ruk / webpack.config.js
Created May 17, 2017 16:28
webpack config
const path = require("path");
const autoprefixer = require("autoprefixer");
const rucksack = require("rucksack-css");
const nested = require("postcss-nested");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const DashboardPlugin = require("webpack-dashboard/plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
@d0ruk
d0ruk / HN_traverse_comments.js
Created July 18, 2017 20:19
async/await recursion
import pMap from "p-map"
const endpoints = {
new: "https://hacker-news.firebaseio.com/v0/newstories.json",
top: "https://hacker-news.firebaseio.com/v0/topstories.json",
best: "https://hacker-news.firebaseio.com/v0/beststories.json",
item: id => `https://hacker-news.firebaseio.com/v0/item/${id}.json`,
user: name => `https://hacker-news.firebaseio.com/v0/user/${name}.json`,
}
@d0ruk
d0ruk / websocket-server.js
Created July 28, 2017 10:04
websocket server
/**
* Copyright (c) 2007-2013, Kaazing Corporation. All rights reserved.
*/
// The Definitive Guide to HTML5 WebSocket
// Example WebSocket server
// See The WebSocket Protocol for the official specification
// http://tools.ietf.org/html/rfc6455
@d0ruk
d0ruk / cognito.yaml
Created December 2, 2017 01:26 — forked from singledigit/cognito.yaml
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
@d0ruk
d0ruk / readme.md
Created October 18, 2018 20:04
openvpn

Quick Start with docker-compose

  • Add a new service in docker-compose.yml
version: '2'
services:
  openvpn:
    cap_add:
     - NET_ADMIN
@d0ruk
d0ruk / cloudformation.yaml
Created March 21, 2019 19:16 — forked from alexjurkiewicz/cloudformation.yaml
Verdaccio CloudFormation template
# Instructions:
# 1. Check all "TODO" comments and make changes if required for your environment
# 2. Provide values for all required parameters and any optional parameters desired
AWSTemplateFormatVersion: '2010-09-09'
Description: Verdaccio - NPM cache / private registry
Parameters:
# REQUIRED PARAMETERS
Ami:
Type: AWS::EC2::Image::Id
@d0ruk
d0ruk / docker-compose.yml
Created November 27, 2018 11:33
nodemon with express+mongoose
version: "3"
services:
mongo:
image: mvertes/alpine-mongo
hostname: mongo
ports:
- 27017:27017
@d0ruk
d0ruk / DOMEventListener.js
Last active March 9, 2020 16:31
JS snippets
// unify because compliance
module.exports = {
on: function(el, eventType, func) {
if (window.addEventListener) {
el.addEventListener(eventType, func, false);
} else {
el.attachEvent("on" + eventType, func);
}
},
@d0ruk
d0ruk / aws-host-static.js
Last active March 9, 2020 16:34
AWS host static folder
const fs = require("fs");
const path = require("path");
const Promise = require("bluebird");
const readdir = require("recursive-readdir");
const { bgRed, bgGreen, bgBlue, bold, white } = require("chalk");
const PKG = require("./package.json");
const AWS = require("aws-sdk");
const s3 = new AWS.S3();
const bucketName = `${PKG.name}-v${PKG.version}`;
@d0ruk
d0ruk / radio-group.html
Created July 16, 2020 01:32 — forked from robdodson/radio-group.html
A Custom Element radio group which demonstrates roving tabindex
<!--
Copyright 2016 Google Inc. All rights reserved.
Licensed 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 CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and