Skip to content

Instantly share code, notes, and snippets.

View zhuzhuaicoding's full-sized avatar

zhuzhu_coder zhuzhuaicoding

View GitHub Profile
@hefangshi
hefangshi / job.js
Created September 8, 2017 11:12
Job
/**
* Created Date: Friday, September 8th 2017, 6:50:56 pm
* Author: hefangshi
* Copyright (c) 2017 Baidu.Inc
*
*/
class Job {
constructor() {
this.running = 0;
@AnnaMag
AnnaMag / .lldbinit
Created January 20, 2017 12:15
helper functions to print V8 Objects
# lldb debugging v8-related functionality in Node.js
# =========================================================
# lldb re-write of user-defined V8 debugging functions
# https://github.com/v8/v8/blob/master/tools/gdbinit
#allow the file to be read when lldb starts (set to false to ignore it)
settings set target.load-cwd-lldbinit true
# Print HeapObjects.
@DmitrySoshnikov
DmitrySoshnikov / asm-addr-mode.md
Last active January 19, 2017 03:07
Addressing modes in `mov`, and their C version
Addressing modes in mov, and their C version

Below are addressing modes (immediate, register, memory) on the examples of the mov assembly instruction. Here we use movl ("move long") for a 32-bit word.

Note: cannot move memory-to-memory, need two instructions.

Src
movl
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@overtrue
overtrue / gist:f540fbea3c33e3da53fd
Created January 12, 2015 09:23
移动端头部meta大全
<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<!-- 声明文档使用的字符编码 -->
<meta charset='utf-8'>
<!-- 优先使用 IE 最新版本和 Chrome -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<!-- 页面描述 -->
<meta name="description" content="不超过150个字符"/>
<!-- 页面关键词 -->
@bluejava
bluejava / Soon
Last active December 22, 2022 06:27
A Very Fast Javascript thread yield (see blog posting)
// See http://www.bluejava.com/4NS/Speed-up-your-Websites-with-a-Faster-setTimeout-using-soon
// This is a very fast "asynchronous" flow control - i.e. it yields the thread and executes later,
// but not much later. It is far faster and lighter than using setTimeout(fn,0) for yielding threads.
// Its also faster than other setImmediate shims, as it uses Mutation Observer and "mainlines" successive
// calls internally.
// WARNING: This does not yield to the browser UI loop, so by using this repeatedly
// you can starve the UI and be unresponsive to the user.
// Note: For an even faster version, see https://gist.github.com/bluejava/b3eb39911da03a740727
var soon = (function() {
@kevincennis
kevincennis / v8.md
Last active July 3, 2024 18:15
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
_script.onload = _script.onreadystatechange = function () {
var uA = navigator.userAgent.toLowerCase();
if (!(!(uA.indexOf("opera") != -1) && uA.indexOf("msie") != -1) || /loaded|complete/i.test(this.readyState)) {
if (typeof onload == "function") {
onload();
}
complete(_jsonpLoadState == "loaded" ? reportSuccessCode : reportErrorCode);
}
};
@EpokK
EpokK / ngEnter.js
Last active January 7, 2022 13:57
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@nosp4mSnippets
nosp4mSnippets / JS:getDocumentHeight
Created June 25, 2013 17:22
JS: get Document Height
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)
);
}