Skip to content

Instantly share code, notes, and snippets.

View davinma's full-sized avatar
⛱️
Working

Davin davinma

⛱️
Working
  • Shanghai, China
View GitHub Profile
@davinma
davinma / htmltocanvas-demo.html
Created December 31, 2021 02:44
html table border to canvas
<!DOCTYPE html>
<html>
<head>
<title>html table border to canvas</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.slim.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/html2canvas/1.3.3/html2canvas.js"></script>
<style>
th, td {
padding: 20px;
@davinma
davinma / greyscale.md
Last active April 7, 2020 09:35
网页变灰

CSS 部分:

body {
  -webkit-filter:grayscale(100%);
  -moz-filter:grayscale(100%);
  -ms-filter:grayscale(100%);
  -o-filter:grayscale(1);
  filter:gray!important;
  filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
@davinma
davinma / utilities.js
Last active June 27, 2019 07:18
JS common utilities.
/**
* 检测 WebGL 是否启用
* 参考 http://www.browserleaks.com/webgl#howto-detect-webgl
* 参考 https://gist.github.com/SeanZoR/cfa7a6206983b775a858
*
* @return { number }
* -1: 不持支 WebGL
* 0: WebGL 被禁用
* 1: WebGL 已启用
*/
@davinma
davinma / vi-text-editor-skills.md
Last active June 21, 2019 04:06
VI text editor skills

VI 编辑器

普通模式

由 Shell 进入 VI 编辑器时,首先进入普通模式。在普通模式下,从键盘输入任何字符都被当作命令来解释。普通模式下没有任何提示符,输入命令后立即执行,不需要回车,而且输入的字符不会在屏幕上显示出来。

普通模式下可以执行命令、保存文件、移动光标、粘贴复制等。

编辑模式

@davinma
davinma / raf.min.js
Created April 25, 2018 07:36
requestAnimationFrame polyfill
window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,n){window.setTimeout(e,1e3/60)},window.requestInterval=function(e,n){if(!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame&&window.mozCancelRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame))return window.setInterval(e,n);var i=(new Date).getTime(),a=new Object;return a.value=requestAnimFrame(function t(){(new Date).getTime()-i>=n&&(e.call(),i=(new Date).getTime()),a.value=requestAnimFrame(t)}),a},window.clearRequestInterval=function(e){window.cancelAnimationFrame?window.cancelAnimationFrame(e.value):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(e.value):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(e.value):window.mozCancelRequestAnimationFrame?window.mozCancelRequestAnimatio
@davinma
davinma / raf.js
Created April 25, 2018 07:35
requestAnimationFrame polyfill
// requestAnimationFrame() shim by Paul Irish
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
@davinma
davinma / wow-cool.css
Last active September 20, 2016 01:52
wow-cool.css
/**
* Base on Stylish
* Material icons from Google Design(https://design.google.com/icons/)
* Base64 encoder from b64.io(http://b64.io/)
**/
@import url(https://fonts.css.network/css?family=Product+Sans:400,700&subset=latin,latin-ext);
body {
-webkit-animation-delay: 0.1s;
@davinma
davinma / wow-pure.css
Last active September 18, 2016 01:26
wow-pure.css
/**
* Base on Stylish
* Material icons from Google Design(https://design.google.com/icons/)
* Base64 encoder from b64.io(http://b64.io/)
**/
body {
-webkit-animation-delay: 0.1s;
-webkit-animation-name: fontfix;
-webkit-animation-duration: 0.1s;
@davinma
davinma / cnbeta.com.css
Last active June 29, 2016 16:04
stylish for cnbeta.com
* {
font-family: \5FAE\8F6F\96C5\9ED1,Tahoma,Verdana,"宋体"!important;
}
html {
background-color:#fff
}
body {
padding-top:0!important
}
iframe[id^=iframe],