This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Request } from 'awi' | |
import { HmacSHA256, enc } from 'crypto-js' | |
export class SignatureFactory { | |
/** | |
* Compute the Amazon request signature. | |
* | |
* @param request The request sign | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Encodes a js object as a url-safe base64 string. | |
encodeURIComponent(btoa(JSON.stringify({ ... }))) | |
// Takes the previously generated string and returns a parsed js object. | |
JSON.parse(atob(decodeURIComponent('...'))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example data. | |
const data = [1, 2, 3] | |
const fn = async a => a * a | |
// If we care about errors. | |
data.reduce((carry, item) => carry.then(() => fn(item)), Promise.resolve()) | |
.catch(console.error) | |
.then(() => { ... }) | |
// If we don't care. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const redirect = (urls) => { | |
const browser = window.chrome ? 'chrome' : window.safari ? 'safari' : 'firefox' | |
const platform = /(chrome|safari|firefox)/i.test(navigator.userAgent) ? 'supported' : 'unsupported' | |
const os = /(android|ios|iphone)/i.test(navigator.userAgent) ? 'mobile' : 'desktop' | |
const parametrize = (url) => { | |
url = new URL(url) | |
Array.from(new URL(location.href).searchParams.entries()).forEach(([k, v]) => url.searchParams.set(k, v)) | |
return url.toString() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import router from './router' | |
/** | |
* Intercept each route with a controller call if there is an existing one. | |
*/ | |
router.beforeEach((to, from, next) => { | |
const controller = to.meta.controller | |
const middleware = to.meta.middleware || [] | |
const request = { to, from } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
libs=(support ioc aop events exceptions core storage messaging tabs cache compatibility management) | |
cd framework/lib | |
git checkout develop | |
for lib in ${libs[@]}; do | |
cd ${lib} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " Latest Vim setting | |
so ~/.vim/plugins.vim | |
syntax enable | |
set backspace=indent,eol,start " Make backspace behave like in any other editor | |
let mapleader=',' " Set the default leader | |
set foldcolumn=2 | |
set autowriteall " Write when switching buffers | |
"---------- Visuals ----------" | |
set background=dark " Set the background to be dark |