Skip to content

Instantly share code, notes, and snippets.

View thunderrun's full-sized avatar

Toumatsu Mimi thunderrun

View GitHub Profile
@thunderrun
thunderrun / HTTP caching.md
Last active May 7, 2023 19:24
HTTP caching cheatsheet

HTTP caching

Types of caches

  • Private browser caches
    • store content in user's browser
    • no requiring an additional trip to the server
    • improves offline browsing
  • Shared proxy caches
  • store content on the proxy server itself
@thunderrun
thunderrun / getUrlEnvPrefix.js
Last active January 14, 2022 01:45
Get Env Prefix from Url
const envPrefix = window.location.host.split('.')[0].match(/[^.\s]+-/) || '';
// https://charlie.alpha-Bravo.com/ -> ''
// https://dev-charlie.alpha-Bravo.com/ -> 'dev-'
export default envPrefix;
@thunderrun
thunderrun / vuex-general-purpose-mutations.js
Last active December 22, 2020 06:54
Vuex General Purpose Mutations
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
set(state, payload) {
state[payload.key] = payload.value;
},
setVer2(state, payload) {
for (const [key, value] of Object.entries(payload)) {
@thunderrun
thunderrun / element-ui-radio-buttons.html
Last active December 22, 2020 06:47
Seperate Element UI Radio Buttons
<template>
<el-radio-group class="radio-buttons">
<el-radio-button label="New York"></el-radio-button>
<el-radio-button label="Washington"></el-radio-button>
<el-radio-button label="Los Angeles"></el-radio-button>
<el-radio-button label="Chicago"></el-radio-button>
</el-radio-group>
</template>
<style scoped>
@thunderrun
thunderrun / merge.bat
Created December 5, 2020 06:10
Merge current branch into master
git push
FOR /F "tokens=*" %%g IN ('git branch --show-current') do (
SET CurrentBranch=%%g
)
git checkout master
git pull
git merge %CurrentBranch%
git push
git checkout %CurrentBranch%
@thunderrun
thunderrun / qzone-album-batch-delete.js
Created December 4, 2020 06:00
删除QQ空间所有相册
const iframe = document.querySelector('iframe[id="tphoto"]').contentWindow;
const expands = iframe.document.querySelectorAll('.js-album-op-tip');
expands.forEach((node) => {
node.click();
});
const elements = iframe.document.querySelectorAll('.js-album-delete');
let index = 0;
const total = elements.length;
@thunderrun
thunderrun / antd-vue-radio-buttons.html
Last active December 4, 2020 05:46
Seperate Ant Design Radio Buttons
<template>
<a-radio-group
class="radio-buttons"
button-style="outline"
>
<a-radio-button value="a">
Hangzhou
</a-radio-button>
<a-radio-button value="b">
Shanghai