1 | 7za x file.7z |
安装
1 | sudo yum install epel-release |
1 | sudo yum install p7zip |
remove script tags
https://stackoverflow.com/questions/7130867/remove-script-tag-from-html-content/7131085
美剧网 《爱,死亡和机器人 第一季》
https://91mjw.com/video/1295.htm
uglifycss –convert-urls test lib/font-awesome-4.7.0/css/font-awesome.min.css lib/ionicons-2.0.0/css/ionicons.min.css lib/mwa/mwa.css lib/animation.min.css \
css/ok.css
1 | ;(function(){ |
1 | if (typeof module != 'undefined' && module.exports) { //CMD |
1 | var root = (typeof self == 'object' && self.self == self && self) || |
via
array remove duplicated item
const arr = [22,33,22,44,22];
// 1
[…new Set(arr)];
// 2
arr.filter((k,j)=>arr.indexOf(k)=== j)
// 3
arr.reduce((tt,k)=>{
console.log(tt,k)
return tt.includes(k) ? tt: […tt,k]
},[])
via
https://medium.com/dailyjs/how-to-remove-array-duplicates-in-es6-5daa8789641c
https://www.npmjs.com/package/uglify-es
需要安装
npm install uglify-es -g
uglifyjs gsmap.js -m -o gsmap.min.js
uglifyjs js/file1.js js/file2.js
-o foo.min.js -c -m
–source-map “root=’http://foo.com/src',url='foo.min.js.map'"
uglifyjs ../lib/axios.min.js gsmap.js
-c drop_console -m -o gsmap.min.js
压缩项目
uglifyjs main.js app.js pos.js
-c drop_console -m -o gs.min.js
let a = Array(14).fill().map((k,j)=>j+1);
a.reduce((tt,k)=>{
return tt+’curl https://i.jd.com/defaultImgs/'+k+'.jpg -o ‘+k+’.jpg\n’;
},’’)
n ES6 using Array from() and keys() methods.
Array.from(Array(10).keys())
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Shorter version using spread operator.
[…Array(10).keys()]
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
https://blog.zfanw.com/babel-js/#babelcli
abc
https://blog.zfanw.com/babel-js/#babel-套餐
const alertMe = (msg) => {
window.alert(msg)
}
class Robot {
constructor (msg) {
this.message = msg
}
say () {
alertMe(this.message)
}
}
const marvin = new Robot(‘hello babel’)
https://blog.zfanw.com/firebase-hosting-static-site/
这是移动端 Safari 至今仍存在的一个 bug 特性。
有几个解决办法:
最简单的,给 CSS 加上 cursor: pointer;
停止委托,直接给 #btn 绑定事件处理器;
给 div 元素加上 onclick=’void(0);’;
将 div 换成其它不受该 bug 特性影响的元素,比如 a、button 等。
A comment first. The question was about not using try/catch.
If you do not mind to use it, read the answer below. Here we just check a JSON string using a regexp, and it will work in most cases, not all cases.
Have a look around the line 450 in https://github.com/douglascrockford/JSON-js/blob/master/json2.js
There is a regexp that check for a valid JSON, something like:
1 | if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@'). |
http://test.mosquitto.org/ws.html
http://louiszhai.github.io/2017/04/28/array/#keys-ES6
https://juejin.im/post/5d66b019f265da03a715e5d7
https://dev.to/saigowthamr/how-to-loop-through-object-in-javascript-es6-3d26
需要一个 autoindex 的 www。先建立一个 guoshuang_labs.conf
1 | server { |
然后 copy 到 docker nginx 容器
1 | docker cp guoshuang_labs.conf nginx:/etc/nginx/conf.d/guoshuang_labs.conf |
重启
1 | docker retart nginx |
1 | # 查找镜像 |
1 | docker cp nginx:/etc/nginx/conf.d/guoshuang_demo.conf guoshuang_demo.conf |
进入容器
1 | docker exec -it nginx bash |
1 | location /somedirectory/ { |
autoindex_exact_size; – This directive specifies whether Nginx should display the exact file sizes of the output in the directory index or simply round to the nearest KB, MB, or GB. This directive has 2 options: on | off.
autoindex_format; – This directive specifies what format the Nginx index listing should be outputted to. This directive has 4 options: html | xml | json | jsonp.
autoindex_localtime; – This directive specifies whether the times for the directory listing should be outputted to local time or UTC. This directive has 2 options: on | off.
docker run –name w3 -d webdevops/php-nginx
sudo apachectl stop
sudo apachectl start
docker stop w3
docker rm w3
docker run –name w3 -p 8088:80 -d
-v ~/ddd/www:/app:ro
-v ~/ddd/guo.conf:/opt/docker/etc/nginx/conf.d:ro
webdevops/php-nginx
docker pull webdevops/php-nginx
home/guoshuang/myphp/
docker stop w3
docker rm w3
docker run –name w3 -p 8088:80 -d
-v /home/guoshuang/myphp/html:/app
-v /home/guoshuang/myphp/conf:/opt/docker/etc/nginx/conf.d:ro
webdevops/php-nginx
docker restart w3
https://blog.csdn.net/yelllowcong/article/details/78483579
shell show date
date +’%Y-%m-%d %T’
https://www.cyberciti.biz/faq/unix-linux-getting-current-date-in-bash-ksh-shell-script/
每分钟
% 要转义
看邮件
cat /var/spool/mail/root
每小时
*/60 * * * * /root/2.sh
注意!!网上大笨蛋
cd /home/guoshuang/myphp/html/corona/data
curl http://127.0.0.1:8088/qs/get-data-world.php
cd /home/guoshuang/myphp/html/qs/data
cd /home/guoshuang/myphp/conf
docker exec -it w3 /bin/bash
http {
server {
index index.html;
}
}
docker restart w3
docker ps
curl 127.0.0.1:8088
【译文】孔子说:“君子庄重自尊不与人争,合群却不因私结党。”
【译文】孔子说:“整天聚在一起,不谈正经的事情,喜欢玩弄小聪明,难有所成!”
【解读】这类人没有人生目标,好耍小聪明。这是我想到了青年时的毛泽东,毛泽东有“三不谈”,不谈金钱、不谈女人、不谈家庭琐事,正好与这类人相反,所以毛泽东成了毛泽东。蔡元培德国留学归来谨守“三不主义”:一不做官,二不纳妾,三不打麻将,因此蔡元培成了蔡元培。孔子不语怪力乱神,我想也与孔子的这样认识相关。
【译文】孔子在陈国的时候断绝了粮食,跟随的人都病了,没有人能爬起来。子路一腔怨气地对孔子说:“君子也有穷困的时候吗?”孔子说:“君子在穷困的时候仍然会坚持。小人穷困的时候,就会胡作非为。”
【译文】孔子说:“君子担心自己到死也没名。”
【译文】孔子说:“所有的人都讨厌他,一定要考察为什么;所有的人都喜欢他,也一定要了解一下为什么。”
【译文】孔子说:“有理想抱负的、有仁德的人,没有人为了求生而伤害仁德的,只会献出生命来成就仁德。”
【译文】孔子说:“严格要求自己少责怪别人,就会远离怨恨。”
【译文】孔子说:“君子担忧自己没本事,不担忧别人不了解自己。”
【译文】孔子说:“人能够弘扬道义,不是道义弘扬人。”
【译文】孔子说:“我曾经整天不吃饭,整宿不睡觉,为了思考,但没有什么收益,还不如去读书学习。”
【译文】孔子说:“君子谋求道义,不谋求衣食。为谋食耕田的人,也难免会饿肚子;为谋求道义去学习的人,就可以做官拿到俸禄。所以君子只担心道义而不担心贫穷。”
【译文】孔子说:“凭头脑得到,不用仁心守住它,虽然得到了,最终也一定会失去它。凭头脑得到,又能用仁心守住它,但不用庄重严肃的态度面对它,老百姓就不会敬重你。凭头脑得到,用仁心守住,以庄敬的态度面对,行动如果不依据礼制,就仍没有达到最好。”
【译文】孔子说:“君子不可以用小聪明小事情考验他,却可以让他承受大使命。小人不可以让他承受重大任务,去可以让他做些小聪明的事情。”
【译文】子张问自己的行为怎样才能正确。孔子说:“说话忠诚守信,行动恭敬踏实,即使是到了蒙昧落后的地方也能行得通。说话不诚实守信,行动不真诚敬慎,就是在本乡本土又怎么能行得通呢?站着,就好像看见 ‘忠信笃敬’几个字在眼前;坐车,就好像看见这几个字可在车前的横木上。这样就到哪都行得通。”子张把这句话写在自己的衣带上。
【译文】孔子说:“严格要求自己少责怪别人,就会远离怨恨。”
【译文】孔子说:“君子以道义为本质,通过礼去实行它,用谦逊的语言表达它,用诚信去成就它。这才是君子啊!”
1 | ['1', '7', '11'].map(parseInt) |
返回的是
[ 1, NaN, 3 ]
[‘1’, ‘7’, ‘11’].map((a,b,c) => console.log(a,b,c));
1 0 Array(3) [ “1”, “7”, “11” ]
7 1 Array(3) [ “1”, “7”, “11” ]
11 2 Array(3) [ “1”, “7”, “11” ]
a 自己
b 序号
c 整个数组
循环的其实是:
parseInt(1,0,array) // 1
parseInt(7,1,array) // NaN
parseInt(11,2,array) // 3
思路:小于的 segment 合并 画 1 个?(填补 segments 之间的 缝隙)
导致新问题: 何时重画 为 小段?
styleFunc 里面不能修改 feature 本身数据!需要 map on change:resolutuon 和 map on moveend (如果 point 视野外 被删除的话)
必须 styleFunction 里面 否则 zoom drag 永远不显示啦!!!!
styleFunction 里面和外面(不进入geojson) return 的区别:全局变量有。但是不画,也点不到。
multiline 多根 -> 1根 缺点是: 不能识别 segment
同理 multi point
短于 10 像素的 line 不画
point 数量 > 2000 不画
point 位置重叠 不画
1 | let res = map.getView().getResolution(); |
注意:这个性能也很差!
1 | // 伟业开 pos_x: 108.939079 pos_y: 34.254787 |
1 | var pos = ol.proj.transform([108,34],'EPSG:4326', 'EPSG:3857'); // |
注意:但是 map.hasFeatureAtPixel 性能很差!!!!!!执行时间很长!
stylefunc_node_default
styleFunction_segment
var a = Array.from(document.querySelectorAll(‘label’));
var a = […document.querySelectorAll(‘label’)];
var a = Array.prototype.map.call(document.querySelectorAll(‘label’),k=>k);
var a = Array.prototype.slice.call(document.querySelectorAll(‘label’))
var a = Array.prototype.filter.call(document.querySelectorAll(‘label’),k=>k);
var a = [];for(i of document.querySelectorAll(‘label’)){a.push(i);}
var a = [], rs = document.querySelectorAll(‘label’);for(i=0;i< rs.length;i++){a.push(rs[i]);}
var a = [], rs = document.querySelectorAll(‘label’);rs.forEach(k=>k);
var a = [];document.querySelectorAll(‘label’).forEach(k=>a.push(k));
var a = [], rs = document.querySelectorAll(‘label’);for(k of rs.entries()){a.push(k);}
var a = [], rs = document.querySelectorAll(‘label’);for(k of rs.entries()){a.push(k[1]);}
var a = [], rs = document.querySelectorAll(‘label’);for(k of rs.values()){a.push(k);}
var a =[];
var rs = document.querySelectorAll(‘label’);
var a = [];
Array.prototype.some.call(document.querySelectorAll(‘label’),k=>{
a.push(k);
});
var a = [];
Array.prototype.every.call(document.querySelectorAll(‘label’),k=>{
return a.push(k);
});
一直找不到。。。
var a = [];
Array.prototype.find.call(document.querySelectorAll(‘label’),k=>{
return !a.push(k);
});
https://medium.com/poka-techblog/simplify-your-javascript-use-map-reduce-and-filter-bd02c593cc2d
https://medium.com/@chuckdries/traversing-the-dom-with-filter-map-and-arrow-functions-1417d326d2bc
for (var elem of Array(3).keys()){
console.log(elem);
}
// If you really want to use forEach…
[…Array(3).keys()].forEach(k => console.log(‘spread syntax -> ‘, k));
// Or using Array.from
Array.from(Array(3).keys()).forEach(k => console.log(‘Array.from ->’, k));
option command / 是很多软件的 注释 快捷键
Alfred的Preferences-File Search - Navigation - Previous Path
https://github.com/stuartcryan/defaultbrowser-alfred-workflow
下载 运行 输入
db
更换浏览器。注意:mac 经常会拦截 第三方软件!在这个界面