Skip to content

Instantly share code, notes, and snippets.

View odykyi's full-sized avatar
🍍
(async () => { /* ...loading */ })();

odykyi

🍍
(async () => { /* ...loading */ })();
View GitHub Profile
@gene1wood
gene1wood / How-to-pass-all-headers-in-CloudFront-using-CloudFormation.md
Last active February 8, 2023 20:24
How to configure CloudFront using CloudFormation to pass all headers

How to configure CloudFront using CloudFormation to pass all headers

How can you configure a CloudFront distribution to pass all headers to the origin if the CloudFront distribution is deployed using CloudFormation? If you deploy the distribution in the AWS Web Console, you can select between None, Whitelist and All. In CloudFront it appears that you can only assert a whitelist of allowed headers. This is done in this area of a CloudFormation resource describing a CloudFront distribution

Resources:
  CloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    Properties:
      DistributionConfig:
@odykyi
odykyi / formats.js
Created October 29, 2019 14:20
date formats for momentjs
const formats = [
'HH:mm:ss',
'DD/MM/YYYY',
'D MMMM YYYY',
'D MMMM YYYY HH:mm',
'dddd D MMMM YYYY HH:mm',
'DD.MM.YYYY HH:mm',
'MM-DD-YYYY HH:mm:ss',
'YYYY-MM-DD HH:mm',
'YYYY-MM-DD HH:mm:ss',
@odykyi
odykyi / encodeRLE.js
Last active October 10, 2019 12:19
Js Javascript / Run-length encoding algorithm / RLE encode encoding
function encode(code) {
if (!code) return '';
let encode = '';
for (let i = 0; i < code.length; i++) {
let count = 1;
for (let j = i; j < code.length; j++) {
if (code[i] !== code[j+1]) break;
count++;
i++;
@odykyi
odykyi / queue.js
Created June 23, 2019 14:57
node js javascript queue implementation example data structure
console.time('queue');
const assert = require('assert'); // for tests
class Queue {
constructor() {
this.list = []
}
isEmpty() {
return !this.list.length;
@odykyi
odykyi / stack.js
Created June 23, 2019 11:38
node js javascript stack implementation example data structure
console.time('stack');
const assert = require('assert'); // for tests
class Stack {
constructor() {
this.list = []
}
isEmpty() {
return !this.list.length;
@odykyi
odykyi / JS.MD
Created September 6, 2018 07:41
JavaScript idiosyncrasies https://odykyi.github.io/javascript-idiosyncrasies/ javascript js brainfuck es6 es7 ecmascript ecmascript6 ecmascript2015 ecmascript2016 ecmascript2017 ecmascript5 react reactjs vue vuejs vuejs2 angular angularjs

JavaScript idiosyncrasies

https://odykyi.github.io/javascript-idiosyncrasies/

This is a collection of things in JavaScript that may not be well recognized, espcially to beginners.

Disclaimer: Some of these snippets are simply to demonstrate the quirky parts of JavaScript and by no means encourage best practices and should never be seen in production code.


@odykyi
odykyi / await-of.js
Created August 9, 2018 08:24
no try/catch in async/await ( nodejs node node.js js error handling arrow function)
module.exports = function of(promise) {
return Promise.resolve(promise)
.then((ret) => ret)
.catch((err) => {
if (!err) {
let error = new Error("Rejection with empty value");
error.originalValue = err;
err = error;
}
import {
  createStore,
  applyMiddleware,
  combineReducers,
  compose,
} from 'redux';
import createSagaMiddleware, { END } from 'redux-saga';

import reducers from './reducers';
@odykyi
odykyi / git remote set url.sh
Last active February 23, 2018 09:54
git remote set url.sh
git remote set url.sh
0. git remote -v
1.1 git remote add origin [email protected]:USERNAME/REPOSITORY.git
1.2 git remote add origin https://github.com/USERNAME/REPOSITORY.git
2.1 git remote set-url origin [email protected]:USERNAME/REPOSITORY.git
2.2 git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
@odykyi
odykyi / .eslintrc
Created December 1, 2017 14:42 — forked from radiovisual/.eslintrc
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true