# snippets **Repository Path**: hippor/snippets ## Basic Information - **Project Name**: snippets - **Description**: 收集开发中常用到的代码片段和遇到的BUG以及空闲时候的编码练习 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-01 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SNIPPETS[![Build Status](https://travis-ci.org/towersxu/snippets.svg?branch=master)](https://travis-ci.org/towersxu/snippets) ## 为什么要做这个 在开发中,常遇到再一个项目中要处理的内容在网上找到了一段代码,写了后,又在其它项目中发现也要用。这个时候又需要把项目找到或者再去网上搜索,效率一点都不高效。如果统一把各种代码片段安装规范的结构写下来,既方便遇到问题来查看,也方便平时来熟悉这些代码 ## 目录 ### comments * [佛祖保佑](https://github.com/towersxu/shippets/blob/master/material/comments/fozu.js) ### css * [placeloading](https://github.com/towersxu/shippets/blob/master/material/css/placeloading.less) ### js * [获取文件的MD5,file对象转blob](https://github.com/towersxu/shippets/blob/master/material/js/file/file.js) * [arraybuffer的应用场景](https://github.com/towersxu/shippets/blob/master/material/js/file/arraybuffer/arraybuffer.md) * [获取文件的后缀名](https://github.com/towersxu/shippets/blob/master/material/js/file/suffix.js) * [xmlHttpRequest中POST传输数据的几种方式](https://github.com/towersxu/shippets/blob/master/material/js/ajax/post.js) * [async,await实现先发两个请求,成功后再发第3个请求](https://github.com/towersxu/snippets/blob/master/material/js/async/async.js) * [获取一个颜色的反色](https://github.com/towersxu/shippets/blob/master/material/js/color/invertColor.js) * [获取随机颜色](https://github.com/towersxu/shippets/blob/master/material/js/color/randomColor.js) * [获取随机16位数](https://github.com/towersxu/shippets/blob/master/material/js/random/randomHex.js) * [字符串方法padStart的polyfill](https://github.com/towersxu/shippets/blob/master/material/js/string/padStart.js) * [中划线字符串转驼峰](https://github.com/towersxu/shippets/blob/master/material/js/string/classify.js) * [时间戳转换为指定个数的时间](https://github.com/towersxu/shippets/blob/master/material/js/time/timestampFormat.js) * [guid](https://github.com/towersxu/shippets/blob/master/material/js/uniqueId/guid.js) * [uuid](https://github.com/towersxu/shippets/blob/master/material/js/uniqueId/uuid.js) * [获取IE浏览器版本](https://github.com/towersxu/shippets/blob/master/material/js/browser/detectIE.js) * [获取浏览器的版本](https://github.com/towersxu/shippets/blob/master/material/js/browser/browser.js) * [获取当前的宿主环境](https://github.com/towersxu/shippets/blob/master/material/js/browser/global.js) * [debounce和throttle](https://github.com/towersxu/shippets/blob/master/material/js/programing/debounceAndThrottle.js) ### nodejs * [express开启cros](https://github.com/towersxu/shippets/blob/master/material/nodejs/cros.js) * [express允许cmd命令](https://github.com/towersxu/shippets/blob/master/material/nodejs/cmd.js) * [http-server开启https](https://github.com/towersxu/shippets/blob/master/material/nodejs/https.md) ### shell * [linux开放指定端口](https://github.com/towersxu/shippets/blob/master/material/shell/port.sh) ### 安全 * [flowplayer视频播发器XSS跨站漏洞](https://github.com/towersxu/shippets/blob/master/material/security/flowplayer.md) * [点击劫持:无X-Frame-Options头信息](https://github.com/towersxu/shippets/blob/master/material/security/xframe.md) * [跨站点请求伪造](https://github.com/towersxu/shippets/blob/master/material/security/csrf.md) * [密码学知识汇总](https://github.com/towersxu/snippets/tree/master/material/algorithm/encryption) ### C/C++ * [数组越界](https://github.com/towersxu/shippets/blob/master/material/c++/array-bound.cpp) ### Media * [调用摄像头](https://github.com/towersxu/shippets/blob/master/material/media/getUserMedia.js) ## BUGS * [开发中遇到未找到原因的问题](https://github.com/towersxu/shippets/blob/master/bugs/unresolve.md) * [移动端开发遇到的问题](https://github.com/towersxu/shippets/blob/master/bugs/mobile.md) * [其它问题](https://github.com/towersxu/shippets/blob/master/bugs/other.md) ### 算法 * [时间复杂度LogN示例](https://github.com/towersxu/shippets/blob/master/material/algorithm/o.js) * [深度优先遍历](https://github.com/towersxu/shippets/blob/master/material/js/traversal/deep-traversal.js) * [广度优先遍历](https://github.com/towersxu/shippets/blob/master/material/js/traversal/breadth-traversal.js) * [对象的深拷贝,使用广度优先遍历解决对象的循环引用](https://github.com/towersxu/shippets/blob/master/material/js/traversal/copydeep.js) * [LRU算法](https://github.com/towersxu/shippets/blob/master/material/algorithm/lru.js) * [最短路径-迪杰斯特拉算法](https://github.com/towersxu/shippets/blob/master/material/algorithm/graph.js) * [排序算法](https://github.com/towersxu/shippets/blob/master/material/algorithm/sort/readme.md)
查看更多 * [Cas](https://github.com/towersxu/shippets/blob/master/material/algorithm/Cas.js) * [背包问题](https://github.com/towersxu/shippets/blob/master/material/algorithm/design/knapsack.js) * [字符串匹配-BM算法](https://github.com/towersxu/shippets/blob/master/material/algorithm/string/bm.js) * [字符串匹配-KMP算法](https://github.com/towersxu/shippets/blob/master/material/algorithm/string/kmp.js)
leetcode * [0001_两数之和](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0001_TwoSum.js) * [0002_链表两数之和](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0002_TwoLinkSum.js) * [0003_最长不重复子字符串](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0003_lengthOfLongestSubstring.js) * [0004_找中位数](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0004_findMedianSortedArrays.js) * [0005_最长回文子字符串](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0005_longestPalindrome.js) * [0006_Z字排列](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0006_ConvertZ.java) * [0007_数字反转](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0007_Reverse.java) * [0008_字符串转数字](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0008_Atoi.java) * [0009_判断回文数字](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0009_Palindrome.java) * [0010_简单正则](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0010_RegMatch.java) * [0011_数字最大区域](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0011_MaxArea.java) * [0012_数字转罗马数字](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0012_IntToRoman.java) * [0013_罗马数字转数字](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0012_RomanToInt.java) * [0014_最长公共前缀字符串](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0014_LongestCommonPrefix.java) * [0015_三数之和](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0015_ThreeSum.java) * [0016_三数之和最接近](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0016_ThreeSumClosest.java) * [0017_电话号码的字母组合](https://github.com/towersxu/shippets/blob/master/material/algorithm/leetcode/0017_LetterCombinations.java)
## 笔记 [记录平时学习的内容](https://github.com/towersxu/snippets/tree/master/notes) ### c++ [宏](https://github.com/towersxu/snippets/blob/master/notes/c%2B%2B/%E5%AE%8F.md) [c++多继承的二义性](https://github.com/towersxu/snippets/blob/master/notes/c++多继承的二义性.md) ### 计算机科学与技术 [深入理解堆与栈](https://github.com/towersxu/snippets/blob/master/notes/cs/%E5%A0%86%E4%B8%8E%E6%A0%88.md) ### js笔记 [setTimeout/setImmediate/process.nextTick的区别](https://github.com/towersxu/snippets/blob/master/notes/javascript/setTimeout%E3%80%81setImmediate%E3%80%81process.nextTick%E7%9A%84%E5%8C%BA%E5%88%AB.md) [位运算异或的常见用途](https://github.com/towersxu/snippets/blob/master/notes/javascript/%E4%BD%8D%E8%BF%90%E7%AE%97%E5%BC%82%E6%88%96%E7%9A%84%E5%B8%B8%E8%A7%81%E7%94%A8%E9%80%94.md) [数、位、浮点数](https://github.com/towersxu/snippets/blob/master/notes/javascript/%E6%95%B0%E3%80%81%E4%BD%8D%E3%80%81%E6%B5%AE%E7%82%B9%E6%95%B0.md) ### 网络 [MQTT](https://github.com/towersxu/snippets/blob/master/notes/network/mqtt.md) [网关的QoS技术]([master](https://github.com/towersxu/snippets/blob/master/notes/network/qos.md)) ### nodejs笔记 npm link ### 动画 [动画相关的文章](https://github.com/towersxu/snippets/blob/master/notes/animate/%E5%8A%A8%E7%94%BB%E7%9B%B8%E5%85%B3%E7%9A%84%E6%96%87%E7%AB%A0.md) ### 工具 [http-server开启https](https://github.com/towersxu/snippets/blob/master/notes/tools/http-server%E5%BC%80%E5%90%AFhttps.md) ### webassembly [webassembly笔记](https://github.com/towersxu/snippets/tree/master/notes/wasm) ### 其它 [indexDb](https://github.com/towersxu/snippets/tree/master/notes/other/indexdb.md) [shadowDom](https://github.com/towersxu/snippets/tree/master/notes/shadowDom) ## interview ### css面试相关 [css模块化](https://github.com/towersxu/snippets/blob/master/interview/css/css%E6%A8%A1%E5%9D%97%E5%8C%96.md) [postcss](https://github.com/towersxu/snippets/blob/master/interview/css/postcss.md) ### electron面试相关 [主进程和渲染器进程的区别](https://github.com/towersxu/snippets/blob/master/interview/electron/1_%E4%B8%BB%E8%BF%9B%E7%A8%8B%E4%B8%8E%E6%B8%B2%E6%9F%93%E8%BF%9B%E7%A8%8B%E7%9A%84%E5%8C%BA%E5%88%AB.md) [如何在两个网页间共享数据](https://github.com/towersxu/snippets/blob/master/interview/electron/2_%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%A4%E4%B8%AA%E7%BD%91%E9%A1%B5%E9%97%B4%E5%85%B1%E4%BA%AB%E6%95%B0%E6%8D%AE.md) ### js面试相关 [promise的polyfill中如果实现微任务的](https://github.com/towersxu/snippets/blob/master/interview/js/promise%E7%9A%84polyfill%E4%B8%AD%E5%A6%82%E4%BD%95%E5%AE%9E%E7%8E%B0%E5%BE%AE%E4%BB%BB%E5%8A%A1%E7%9A%84.md) ### webpack [webpack笔记](https://github.com/towersxu/snippets/blob/master/interview/webpack/vue%E9%A1%B9%E7%9B%AEwebpack%E5%8D%87%E7%BA%A7%E7%AC%94%E8%AE%B0.md) ### 其它面试相关 [什么是AMP](https://github.com/towersxu/snippets/blob/master/interview/performance/apm.md)