Skip to content

Instantly share code, notes, and snippets.

@menxu
menxu / nodejs-spider.md
Last active March 21, 2017 06:34
Nodejs 爬网页

Nodejs 爬网页

html

#!/usr/bin/env nodejs

//前序任务  jalan_init_task
//后续任务  jalan_info
//提取list页面中住宿url,生成页面爬取任务
//

Bootstrap V3 CSS

Bootstrap V3 样式

1.概览

@menxu
menxu / dir_open_file.md
Last active April 20, 2016 06:57
遍历目录 读取文件 处理生成新文件

遍历目录下的文件处理文件

require 'json'

def dir_files(dir_path)
  return [] unless File.directory?(dir_path)

 files =Dir.entries(dir_path).map do |f|
@menxu
menxu / web-servers.md
Created April 15, 2016 03:49 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# 有关 Fiber 的解释: (按照数据流的方向分为两部分)
# 在 `主线程' 中使用 resume 方法来启动(或继续执行)一个 `纤程'.
# 1. 第一次调用 fiber.resume, 会启动一个纤程,
# 如果 resume 调用时提供了实参, 会作为代码块形参传入代码块.
# 2. 如果非第一次调用 fiber.resume, 即, `恢复' 一个纤程, 会做两件事:
# - 从上次离开纤程的那个位置(调用 Fiber.yield 离开纤程的那个位置), 恢复纤程的执行.
@menxu
menxu / nginx.conf
Created October 30, 2013 04:45 — forked from mimosz/nginx.conf
# sudo ln -s ~/nginx.conf unicorn.conf
upstream app_server {
server unix:/tmp/unicorn_padrino.sock fail_timeout=0;
}
server {
listen 80;
charset utf-8;
server_name db.innshine.com;
@menxu
menxu / git基础
Created August 10, 2012 02:54
基本的pull-push-clone
pull
git checkout
git status
git remote -v
git pull mk master
git status
clone
git clone git://github.com/ayumin/ruby.git