Skip to content

Instantly share code, notes, and snippets.

View crazyjingling's full-sized avatar

xingyunxing crazyjingling

View GitHub Profile
@crazyjingling
crazyjingling / htmlToText.js
Last active June 24, 2016 06:16
html to text
/**
* 去掉 html 标签,得到纯文本
*/
var fs = require('fs');
fs.readFile('./2.js',{encoding: 'utf8'}, function (err, result) {
var html = result;
html = html.replace(/ /ig, ' ');
html = html.replace(/\n\s*\n/g, '\n');
html = html.replace(/<br[^>]*>/ig, '\n');
html = html.replace(/<\/p><p[^>]*>/ig, '\n');
{
apps: [{
"name": "cms",
"cwd": "./tocyc-cms",
"script": "bin/www",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"log_file": "../.log/cms/cms.log",
"error_file": "../.log/cms/cms-err.log",
"out_file": "../.log/cms/cms-out.log",
"pid_file": "../.log/cms/cms.pid",
# 日志格式
log_format main '$remote_addr - $remote_user $server_name [$time_local] "$request" '
'$status $body_bytes_sent "$request_body" "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "clickpid=$cookie_clickpid" "clickaid=$cookie_clickaid"';
access_log logs/access.log main;
@crazyjingling
crazyjingling / code
Last active May 9, 2016 03:45
true or false
// 判断debugColors无效
return '0' !== debugColors
&& 'no' !== debugColors
&& 'false' !== debugColors
&& 'disabled' !== debugColors;
//
@crazyjingling
crazyjingling / HTML-tags.md
Created April 22, 2016 04:28 — forked from yisibl/HTML-tags.md
常用的 HTML 头部标签

常用的 HTML 头部标签

详细介绍参见原文:yisibl/blog#1

<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
    <meta charset='utf-8'> <!-- 声明文档使用的字符编码 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用 IE 最新版本和 Chrome -->
var logger = require('./middlewares/logger').logger;
var fs = require('fs');
var browserSync = require('browser-sync').create();
var del = require('del');
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({
lazy: true
});
var minifycss = plugins.minifyCss;
var concat = plugins.concat;
@crazyjingling
crazyjingling / .gitignore
Last active April 13, 2016 03:31
gitignore
# below are ignore files, here is detail about gitignore : https://git-scm.com/docs/gitignore(examples: https://github.com/github/gitignore)
# node_modules
node_modules
# all .idea
**/.idea
# npm
npm-debug.log
@crazyjingling
crazyjingling / .editorconfig
Created April 13, 2016 03:02
usual editorconfig
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
indent_style = tab
@crazyjingling
crazyjingling / package.json
Created April 13, 2016 03:01
npm package.json
{
"name": "demo-npm",
"version": "1.0.0",
"private": true,
"engines": {
"node": ">=0.10.3 <0.12"
},
"description": "About Npm",
"main": "index.js",
"bin": {