Skip to content

Instantly share code, notes, and snippets.

View xiaomuzhu's full-sized avatar
🎯
Focusing

寻找海蓝 xiaomuzhu

🎯
Focusing
View GitHub Profile
@xiaomuzhu
xiaomuzhu / coderun.json
Last active May 27, 2022 23:11
未命名
{"config":{"codeTheme":"AtomOneDark","pageThemeSyncCodeTheme":true,"openAlmightyConsole":false,"autoRun":true,"layout":"default","keepPreviousLogs":true,"codeFontSize":16},"title":"未命名","code":{"HTML":{"language":"html","content":"<div id=\"hello-vue\" class=\"demo\">\n{{ message }}\n</div>","resources":[]},"CSS":{"language":"css","content":".demo {\n font-family: sans-serif;\n border: 1px solid #eee;\n border-radius: 2px;\n padding: 30px 30px;\n margin-top: 1em;\n margin-bottom: 40px;\n user-select: none;\n overflow-x: auto;\n}\n","resources":[]},"JS":{"language":"javascript","content":"const HelloVueApp = {\n data() {\n return {\n message: \"Hello Vue!!!\",\n };\n },\n};\n\nVue.createApp(HelloVueApp).mount(\"#hello-vue\");\n","resources":[{"name":"Vue 3","url":"https://cdn.bootcdn.net/ajax/libs/vue/3.2.0-beta.7/vue.global.js"}]},"VUE":{"language":"vue2","content":"","resources":[]}}}
@xiaomuzhu
xiaomuzhu / gist1.js
Last active January 15, 2020 20:17
快速排序与冒泡排序在数据规模不同情况下的执行时间差异
function bubbleSort(arr) {
for (var j = 0; j < arr.length - 1; j++) {
// 这里要根据外层for循环的 j,逐渐减少内层 for循环的次数
for (var i = 0; i < arr.length - 1 - j; i++) {
if (arr[i] > arr[i + 1]) {
var temp = arr[i]
arr[i] = arr[i + 1]
arr[i + 1] = temp
}
}
@xiaomuzhu
xiaomuzhu / redux.js
Last active August 2, 2019 11:09
简易redux升级版
const createStore = function (initState, reducer) {
let state = initState;
const listeners = [];
/**
* 订阅
* @param {func} listener 订阅者,为一个回调函数
*/
function subscribe(listener) {
listeners.push(listener);
const createStore = function (initState, reducer) {
let state = initState;
const listeners = [];
/**
* 订阅
* @param {func} listener 订阅者,为一个回调函数
*/
function subscribe(listener) {
listeners.push(listener);
const createStore = function (initState, reducer) {
let state = initState;
const listeners = [];
/**
* 订阅
* @param {func} listener 订阅者,为一个回调函数
*/
function subscribe(listener) {
listeners.push(listener);
const createStore = function (initState, reducer) {
let state = initState;
const listeners = [];
/**
* 订阅
* @param {func} listener 订阅者,为一个回调函数
*/
function subscribe(listener) {
listeners.push(listener);
atom