This file contains 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
module.exports.repeatWord = (length) => _char => Array.from({ length }, e => _char).join('') | |
module.exports.range = (length, start = 0) => Array.from({ length }, (_, i) => i + start) | |
module.exports.zeroAdd = (length, str) => (repeatWord(length)('0') + str).slice(length * -1) |
This file contains 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 * as _vue from "./vue"; | |
declare global { | |
const Vue: typeof _vue.Vue; | |
} |
This file contains 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
export function logger(...arg){ | |
let parrent = new Error() | |
.stack | |
.split("\n")[2] | |
.trim() | |
.replace(/^at /, '') | |
.replace(__dirname, '') | |
let log = arg.forEach(e=>{ e = typeof e === 'string' ? e : JSON.stringify(e, null, 4)}).join(' ') | |
return log | |
} |
This file contains 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
" Fisa-vim-config | |
" http://fisadev.github.io/fisa-vim-config/ | |
" version: 8.3.1 | |
" ============================================================================ | |
" Vim-plug initialization | |
" Avoid modify this section, unless you are very sure of what you are doing | |
let vim_plug_just_installed = 0 | |
let vim_plug_path = expand('~/.vim/autoload/plug.vim') |
This file contains 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
FROM ubuntu:12.04 | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
RUN apt-get install -y build-essential && \ | |
apt-get install -y python-software-properties software-properties-common && \ | |
apt-get install -y byobu curl git htop man unzip vim wget pkg-config libdbus-1-dev && \ | |
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ | |
apt-get update && \ | |
apt-get install -y gcc-4.9 g++-4.9 && \ |
This file contains 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 | |
sudo apt-get update | |
sudo apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo apt-key fingerprint 0EBFCD88 |
This file contains 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
function get(url, data, headers = []) { | |
let formBody = !!data ? Object.keys(data).map(k => `${encodeURIComponent(k)}=${data[k]}`).join('&') : ''; | |
let getUrl = formBody.length ? `${url}?${formBody}` : url; | |
let header = new Headers({ | |
'Accept': 'application/json', | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}) | |
headers.map(ele => { | |
const { name, value } = ele | |
if (name && value) |
This file contains 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
// from parent javascript would be | |
window.addEventListener('message', function(event){ | |
// event handle | |
console.log(event) | |
}) | |
// use button click to send event 'test' could be anything | |
function send(){ | |
let iframe = window.frames[0]; | |
iframe.postMessage('test', document.querySelector('iframe').src); |
This file contains 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
Show hidden characters
{ | |
"compileOnSave": false, | |
"buildOnSave": false, | |
"compilerOptions": { | |
"module": "commonjs", | |
"target": "es6", | |
"noImplicitAny": false, | |
"sourceMap": false, | |
"outDir": "./dist/", | |
"typeRoots": [ |
This file contains 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 * as Stomp from 'webstomp-client'; | |
import * as WebSocket from 'ws' | |
export class STOMP { | |
public state: STOMPState; | |
public messages: Stomp.Message; | |
private _config: StompConfig; | |
private _client: Stomp.Client; | |
private _resolvePromise: { (...args: any[]): void }; | |
private _connectCallBack: (mes: Stomp.Message) => any; |