Skip to content

Instantly share code, notes, and snippets.

Code Review


Code Review 的好处都有啥

Code Review 的好处都有啥,谁说对了就给他

  • 提高代码质量。
  • 互相学习,增进友♂情。
  • 帮助大家了解系统,万一跑路了,代码就没人能维护了。
  • 避免一些东西被错误的使用,例如左神写了一个jquery的插件,结果被我用瞎了。

Code Review Check List

@bruce-shi
bruce-shi / disable_signals.py
Created September 18, 2016 02:44 — forked from RobertKolner/disable_signals.py
Temporarily disable all signals in django.
from collections import defaultdict
from django.db.models.signals import *
class DisableSignals(object):
def __init__(self, disabled_signals=None):
self.stashed_signals = defaultdict(list)
self.disabled_signals = disabled_signals or [
pre_init, post_init,
pre_save, post_save,
@bruce-shi
bruce-shi / upgrade-postgres-9.3-to-9.5.md
Created September 18, 2016 11:56 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
@bruce-shi
bruce-shi / Rails中文纠错.md
Last active October 8, 2024 07:39
Postgres 中文分词 和 模糊纠错实现,smlar, zhparser

Rails Fuzzy Match

纠错算法

英文纠错

  • 拼写错误
  • 错别字

Levenshtein, n-gram
pg_trgm
select similarity('yue mian ke ji', 'yu mian ke ji')
fuzzystrmatch

#! /usr/bin/env bash
if (( EUID != 0 )); then
echo “Please run this command with sudo” 1>&2
exit 1
fi