Skip to content

Instantly share code, notes, and snippets.

View MQuy's full-sized avatar
🎯
Focusing

Minh Quy MQuy

🎯
Focusing
View GitHub Profile
<html lang="en">
<head>
<link rel="preload" href="./vendor.js" as="script">
<link rel="preload" href="./app.js" as="script">
<body>
<main id="root" style="height: 100%"></main>
<script type="text/javascript">
scripts = ['./vendor.js','./app.js'];
if (!("fetch" in window && "Promise")) {
compilation.plugin('html-webpack-plugin-alter-asset-tags', (htmlPluginData, cb) => {
...
htmlPluginData.body = inlineTags.concat([{
tagName: 'script',
closeTag: true,
attributes: {
type: 'text/javascript'
},
innerHTML: template
}]);
@MQuy
MQuy / webpack.md
Last active May 12, 2017 20:08
webpack.md

Optimize

Recently, when we check javascript error logs in our system, we notice that there are several issues which are related to the "old browser" like

Uncaught ReferenceError: Promise is not defined
Uncaught ReferenceError: fetch is not defined
@MQuy
MQuy / split_case.ex
Last active February 12, 2017 13:52
ElixirVN - Exercise
defmodule App do
def split_case(str), do: split_case(str, [[], []])
def split_case(<<char, remain :: binary>>, [upper, lower]) when char < 97 do
split_case(remain, [[upper, char], lower])
end
def split_case(<<char, remain :: binary>>, [upper, lower]) do
split_case(remain, [upper, [lower, char]])
end
def split_case("", [upper, lower]) do
set -g prefix C-a
unbind C-b
bind a copy-mode
bind r source-file ~/.tmux.conf
setw -g mode-keys vi
set -g status-keys vi
set -g mouse on
@MQuy
MQuy / vimrc
Last active October 18, 2017 06:23
Vim Config
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
let mapleader = "\<Space>"
call vundle#rc()
Bundle 'gmarik/vundle'