Skip to content

Instantly share code, notes, and snippets.

import qs from 'qs'
import scriptjs from 'scriptjs'
const $schoolMap = document.getElementById('school-map');
const baiduMapUri = 'http://api.map.baidu.com/getscript';
const baiduMapConf = {
v: '2.0',
ak: 'YOUR_ACCESS_KEY'
};
import { createStore } from 'reflux';
import GalleryActions from '../actions/GalleryActions'
export default createStore({
init(){
this.galleryMap = {}
this.listenTo(GalleryActions.listGalleries.completed, 'onGalleryListUpdate')
this.listenTo(GalleryActions.getGallery.completed, 'onGalleryUpdate')
# kill all docker process
docker rm $(docker ps -a -q)
# remove untaged images
docker rmi $(docker images -a | grep "^<none>" | awk '{print $3}')
function docker-safe-rm {
(docker ps -a -q -f name=$1$ || echo :) | xargs docker rm -f
}
@morlay
morlay / App.css
Created December 3, 2015 15:50
A trick way to write nesting css by css-modules
.app {
padding: 6px 20px 30px;
}
.subText {
composes: text from "./Child.css";
color: red;
}
import _ from 'lodash';
const wechatScript = '//res.wx.qq.com/open/js/jweixin-1.1.0.js';
export const loadSdk = () =>
new Promise((resolve) => {
require('scriptjs')(wechatScript, () => {
resolve(global.wx);
});
});
@morlay
morlay / switch_captive_portal_server.sh
Created March 29, 2016 02:14
Switch Captive Portal Server in Mars
adb shell "settings put global captive_portal_server g.cn"
@morlay
morlay / Store.js
Created August 4, 2016 01:31
Simple Redux-like Store
class Store {
constructor(reducer, initialState) {
this.state = initialState;
this.reducer = reducer;
this.trigger = () => null;
}
subscribe(callback) {
this.trigger = callback;
}
@morlay
morlay / MapWorld.ts
Created January 24, 2019 06:38
MapWorld.ts
import { mat4 } from "gl-matrix";
import { Map, Transform } from "mapbox-gl";
import {
Camera,
Group,
Light,
Matrix4,
Object3D,
Scene,
Vector3,
@morlay
morlay / wsl.md
Last active April 14, 2021 03:08
# WSL 初探

WSL 1 的坑已经不修了,WSL 2 还是走向了虚拟化。 因此,WSL 是另一个系统,并且和纯 Linux 有所差异

文件

Windows in WSL

通过 /mnt/c,/mnt/d 等路径,可以在 WSL 直接访问到 Windows 中的文件。 甚至是调用 Windows 的命令,添加 PATH 即可: