Skip to content

Instantly share code, notes, and snippets.

@RobertWang
RobertWang / cloudSettings
Last active January 27, 2021 09:01
VSCode 配置 - MacBook15
{"lastUpload":"2021-01-27T08:52:53.923Z","extensionVersion":"v3.4.3"}
@RobertWang
RobertWang / prn_obj.py
Created September 18, 2016 14:50 — forked from ideadsnow/prn_obj.py
python 打印对象全部属性
def prn_obj(obj):
print ', '.join(['%s:%s' % item for item in obj.__dict__.items()])
@RobertWang
RobertWang / graceful_auto_reconnect.py
Created August 23, 2016 09:06 — forked from anthonywu/graceful_auto_reconnect.py
Gracefully handle a PyMongo AutoReconnect
import functools
import pymongo
import logging
import time
MAX_AUTO_RECONNECT_ATTEMPTS = 5
def graceful_auto_reconnect(mongo_op_func):
"""Gracefully handle a reconnection event."""
@functools.wraps(mongo_op_func)
@RobertWang
RobertWang / affirmation
Created October 31, 2015 18:15
MuleSoft Contributor Agreement Acceptance by Robert
I, Robert, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Sun Nov 01 2015 02:15:42 GMT+0800 (CST)
@RobertWang
RobertWang / Nodejs_开发指南_书摘.md
Last active August 29, 2015 14:07
Node.js 开发指南 书摘(2014年国庆期间阅读)

Node.js 开发指南

书摘

  • 事件触发

  • 单线程

  • 无阻塞

  • 模块和包

@RobertWang
RobertWang / functions.sh
Created July 31, 2014 02:20
[sh]判断一个进程是否启动
ps_check () {
psname="$1"
#pslist=`ps aux | grep $psname`
pscount=`ps aux | grep $psname | wc -l`
pscount=`expr $pscount`
if [ "$pscount" -gt 1 ]
then
echo $psname" is running ... [Success]"
else
echo $psname" is not run ... [Fail]"
@RobertWang
RobertWang / install_mysql_python_mod.sh
Created May 27, 2014 07:44
[sh]Install MySQL-python on OSX
sudo -s
CFLAGS=-Qunused-arguments
CPPFLAGS=-Qunused-arguments
ARCHFLAGS="-arch x86_64"
CFLAGS=-Wunused-command-line-argument-hard-error-in-future
pip install mysql-python
@RobertWang
RobertWang / compatible.php
Last active August 29, 2015 14:01
[php]php5通用兼容的公共文件
<?php
/*
每次新项目, 都要为环境配置做许多php的修正, 为此, 我整理了这一份通用的php抬头文件.
使用方法, 将代码保存为某个php文件, 然后在项目中引入即可.
代码作用如下:
1: 规范化编码问题, utf-8, 时间区域, 数字长度都有变更.
2: 规范化字符转义问题, 全部采用php5.3之后的标准, 都不转化.
3: session, gzip做判断启动. 这有利于防止隐性冲突.
4: 对SERVER数组进行整理, 隐藏掉一些非安全段, 增加以HTTP_开头的一些数据, 如内存占用, 起始时间, 当前url地址, ip, get, post等等. 你只要打印出$_SERVER数组, 基本上许多数据就都有了, 并且它是超全局的.
@RobertWang
RobertWang / [css]纯CSS单行文本溢出追加省略号.md
Created May 9, 2014 03:02
[css]纯CSS单行文本溢出追加省略号

之前一直以为单行文本溢出追加省略号没法兼容所有浏览器,经元泉同志提点,顺利解决:

示例

样式代码,四个属性都是必须的,并且宽度必须设在当前容器上,父容器定宽无效:

.box {
	width: 200px;
	white-space: nowrap;
@RobertWang
RobertWang / clone_mysql_table.sql
Created May 9, 2014 02:57
[mysql]在MySQL数据库中拷贝数据表
-- 在 MySQL 中拷贝表,将 old_table 表拷贝为 new_table 表。
-- 1. 不拷贝表数据,只拷贝结构。
CREATE TABLE new_table LIKE old_table
-- 2. 通过 SELECT 查询来拷贝,new_table 表会丢失主键、索引等信息。
CREATE TABLE new_table AS