Skip to content

Instantly share code, notes, and snippets.

@morrxy
morrxy / queryString.js
Last active April 18, 2018 10:50
[获取url查询串] #javascript
function queryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
return r !== null ? decodeURIComponent(r[2]) : null
}
@morrxy
morrxy / cp.md
Created April 12, 2018 08:17
[拷贝多个目录] #shell
@morrxy
morrxy / vertical-center.scss
Last active April 11, 2018 03:08
[垂直居中] #css
.tip-mask {
z-index: 200;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
.update-tip {
@morrxy
morrxy / getDomain.js
Created March 15, 2018 08:12
[获取host后两位] #javascript
function getDomain(host) {
var a = host.split('.')
var s = a.slice(a.length - 2)
return '.' + s.join('.')
}
getDomain(location.host)
@morrxy
morrxy / image.md
Last active March 14, 2018 01:19
[create image in cli] #shell
@morrxy
morrxy / await.js
Last active February 12, 2018 09:35
await #await #javascript
// parallel
await Promise.all([someCall(), anotherCall()]);
// error handle use promise
function foo() {
return bar();
}
function bar() {
return Promise.reject(new Error('Uh oh!'));
@morrxy
morrxy / fis.md
Created February 11, 2018 02:55
fis3 配置 #fis
"fis": "fis3 release -d output -c",
"fisprod": "fis3 -f fis-conf-prod.js release -d outputprod -c",

fis.set('query', 't=' + Date.now())
//当设置使用编译缓存,每个文件的编译结果均会在磁盘中保存以供下次编译使用
fis.match('::image', {
  query: '?'+fis.get('query'),
  // 开发
  // domain: "https://n.static.dwtv.tv/h5/gameshell",

// 测试

{"sig":"36fae7d8c5889ae8228a67a7ee61912577572cc2a9ac9fc78eb056784e2f5e3c2af9d36d8a0fe62425f2306ff40d79eafab6540f9c797365468fbaf85cda0af50","msghash":"2624ef445a7baa5241221dfa2d2fac7d83b7fd4de3a926fd27294f042737b572"}
@morrxy
morrxy / window-scroll.md
Last active November 9, 2017 06:15
[window scroll] #javascript

use jquery

var scrollTop = $(window).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(window).height();

if ((scrollTop + windowHeight) == scrollHeight) {
    console.log('scroll to bottom')
}
@morrxy
morrxy / nohup.md
Created October 11, 2017 05:23
[nohup] #shell