Skip to content

Instantly share code, notes, and snippets.

View deemstone's full-sized avatar

Jicheng Li deemstone

View GitHub Profile
@deemstone
deemstone / 0_reuse_code.js
Created November 13, 2013 04:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@deemstone
deemstone / javascript_resources.md
Created November 13, 2013 04:22 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@deemstone
deemstone / css_resources.md
Created November 13, 2013 04:22 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@deemstone
deemstone / line-by-line.js
Last active January 20, 2020 05:40
By Nodejs , read large file line by line. mainly created for logfile processing.
/*
* 逐行读取文件
* 分段读取文件
*/
var fs = require('fs');
//每段读取的长度
//@param inputFile{filepath}
//@param onEnd{func} 所有内容读完了
module.exports = function(inputFile, onEnd){
var sLength = 1024;
@deemstone
deemstone / demo.js
Created April 10, 2014 08:53
line-by-line read large text file
var lineReader = require('./line-by-line.js');
var fetchBlock = lineReader( filepath );
var i = 0; //从最开始计数,第几行
var fetchLine = function(callback){
var line = lines.shift();
if(!line){
fetchBlock(function(lns, start){
@deemstone
deemstone / isIE.js
Created May 13, 2014 02:49
These code shoudn't be write more than once! For enviroment detecting, Cross browser, Minimal impletions. Just copy to use.
/*
* if this is IE Browser
*/
!!(window.attachEvent && !window.opera);
@deemstone
deemstone / bootstrap_variables_meicaigreen.less
Created August 17, 2016 05:34
customize bootstrap color
{
"vars": {
"@gray-base": "#626262",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#3ACA6C, 6.5%)",
"@brand-success": "#40C46D",
@deemstone
deemstone / memory.js
Created August 22, 2017 12:04
Observe the various types of variable memory footprint by heapdump(通过heapdump直观观察JS变量内存占用情况)
'use strict';
/*
* 使用heapdump这个工具,可以在Nodejs中做各种「内存探索实验」
*
* 运行脚本
* node --expose-gc memory.js
*
* 会在当前目录下生成一列 n.xxxx.heapsnapshot 的文件,可以在Chrome DevTools > Memory 界面导入,详细分析
*/
var heapdump = require('heapdump');