Skip to content

Instantly share code, notes, and snippets.

View zhuzhuaicoding's full-sized avatar

zhuzhu_coder zhuzhuaicoding

View GitHub Profile
@zhuzhuaicoding
zhuzhuaicoding / debugging_c_with_llvm.md
Created May 27, 2017 06:25 — forked from gregmalcolm/debugging_c_with_llvm.md
Debugging C with llvm's clang and lldb

Assuming you llvm installed (comes as standard on Mac OS Mavrick xtools)

Create a helloworld.c file:

  #include<stdio.h>
  
  int main()
  {
 int x=3;
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
@zhuzhuaicoding
zhuzhuaicoding / loading-animate
Created January 22, 2017 06:41
加载动画,3个小长方形块,一个一个变大,抖动那样子
//css
#loading{
position: fixed;
width: 40px;
height: 20px;
top: 50%;
left: 50%;
margin-left: -20px;
margin-top: -10px;
}
.anim-fill-both {
animation-fill-mode: forwards;
}
//animations
@keyframes pop {
0% {
transform: scale(0.9) translateZ(0);
}
100% {
function* iterTree (tree) {
if (Array.isArray(tree)) {
for (var i = tree.length - 1; i >= 0; i--) {
yield* iterTree(tree[i])
}
} else {
yield tree
}
}
const tree = [ 'a', ['b', 'c'], ['d', 'e'] ];
let arr = [3, 5, 2, 2, 5, 5];
let unique = [...new Set(arr)]; // [3, 5, 2]
function merge() {
var i,
args = arguments,
len,
ret = {},
doCopy = function (copy, original) {
var value, key;
// An object is replacing a primitive
if (typeof copy !== 'object') {
.triangle_up{position:absolute;top:-5px;left:50%;border:0 none;border-top:1px solid #BDBDBD;border-right:1px solid #BDBDBD;background:#fff;background:-moz-linear-gradient(top,rgba(255,255,255,.96) 0,rgba(255,255,255,.96) 55%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,right top,left bottom,color-stop(0%,rgba(255,255,255,1)),color-stop(55%,rgba(255,255,255,1)),color-stop(56%,rgba(255,255,255,0)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(right top,rgba(255,255,255,.96) 0,rgba(255,255,255,.96) 55%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);background:linear-gradient(to left bottom,rgba(255,255,255,.96) 0,rgba(255,255,255,.96) 55%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);width:8px;height:8px;margin-left:-4px;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.7071067811865483, M12=0.7071067811865467,M21=-0.707
escapeHTML: function (a) {
var b = document.createElement("div"), c = document.createTextNode(a);
return b.appendChild(c), b.innerHTML
}
function (a) {
return a.replace(/[&'"<>\/\\\-\x00-\x09\x0b-\x0c\x1f\x80-\xff]/g,function (c) {
return"&#" + c.charCodeAt(0) + ";"
}).replace(/ /g, "&nbsp;").replace(/\r\n/g, "<br />").replace(/\n/g, "<br />").replace(/\r/g, "<br />")
};