Skip to content

Instantly share code, notes, and snippets.

View shenqihui's full-sized avatar
💭
I may be slow to respond.

大饼 shenqihui

💭
I may be slow to respond.
View GitHub Profile
@shenqihui
shenqihui / app.js
Last active October 22, 2019 07:56
微信小程序获取 global 全局调试对象,直接控制台访问某个值调试 ,解决 lodash 的问题。
import './global';
import debugAdd, { globalAdd } from './debug';
App({
// ........ 一大堆的东西
});
const app = getApp();
debugAdd('app', app); // 直接控制台 console 那边 debugAddSave.app 查看内存
@shenqihui
shenqihui / getDateTimeStamp.js
Last active October 11, 2019 06:30
获取时间偏移的js ,如2天前,23小时前,59分钟前,刚刚,59秒前,MM-DD , YY-MM-DD ,以时间最短可读计算。
/* dateStr 的格式为'2018-11-25 16:14:24' */
function getDateDiff(dateStr) {
var publishTime = getDateTimeStamp(dateStr) / 1000,
d_seconds,
d_minutes,
d_hours,
d_days,
timeNow = parseInt(new Date().getTime() / 1000),
d,
@shenqihui
shenqihui / index.html
Last active September 3, 2018 14:32
圆环进度条 css + html
<!DOCTYPE html>
<html lang="en">
<body>
<style>
.percentage-box {
box-sizing: border-box;
width: 210px;
height: 210px;
position: relative;
background-color: #ff6e00;
@shenqihui
shenqihui / README.md
Last active April 9, 2024 17:03
前端面试的笔试题

前端面试笔试题说明

出题的意义

  • 初步筛选出面试者,不用来一遍公司才发现不合适,节省面试者的时间。
  • 现场作答,由于面试者没带电脑,不方便作答,没法体现自己的能力。
  • 通过回答了的题目,提前判断出面试者的水平,节省面试的时间。
  • 让面试者充分准备。
@shenqihui
shenqihui / object_entries.js
Last active May 31, 2019 08:22
WXS 中遍历对象
// 文件名应该是 object_each.wxs , github 上没法识别,所以直接用 js 后缀,如果name 中含有 " 引号,那就洗洗睡吧,不适合这样的业务。
// 匹配 key 的 regex
var keyRe = getRegExp('"[^"]+":', 'img');
// 匹配 name 替换的 regex
var replaceRe = getRegExp('[":]', 'img');
var objectEntries = function (target) {
var entries = [];
var targetString = JSON.stringify(target);
@shenqihui
shenqihui / download.txt
Created October 25, 2017 10:01
react download
const onDownload = (link) => {
const tempLink = document.createElement('a');
tempLink.href = link;
tempLink.setAttribute('download', 'img.png');
tempLink.setAttribute('target', '_blank');
document.body.appendChild(tempLink);
setTimeout(() => {
tempLink.setAttribute('download', 'qrcode.png');
tempLink.click();
document.body.removeChild(tempLink);
@shenqihui
shenqihui / install_net_speeder.sh
Created April 17, 2017 02:45
net-speeder install for banwagong openvz vps
#!/bin/bash
# Check if user is root
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this script!\n"
exit 1
fi
echo "=========================================================================\n"
printf "Auto install net-speeder on your vps,written by tennfy \n"
printf "Version 0.1 \n"
@shenqihui
shenqihui / README.md
Last active August 30, 2016 08:30
异步远程 content 的angular service 。

使用例子

例子1

  <div
    remote-content
    remote-href="{{'mobile/module_list/' + descItem.id}}"
 remote-modal="formData.list[{{$index}}].modal"
@shenqihui
shenqihui / README.md
Last active August 26, 2016 09:37
ui select need to focus invalid

useage

import UiSelectContainer   from './services/ui_select_container';

angular.module('app', [UiSelectContainer.name])
@shenqihui
shenqihui / README.md
Last active December 7, 2017 02:29
fab 部署脚本

部署脚本


这是我常用的 fab 部署脚本的改写通用版本。

可能对大型项目没起作用,但是对于小项目,作用还是很大,所以发出来写个文章分享下。