Skip to content

Instantly share code, notes, and snippets.

function testArray(array $array){
sort($array);
$max = array_pop($array);
$arrLen = count($array);
$len = pow(2, $arrLen);
for($i = 0; $i < $len; $i++){
$byte = sprintf('%0+'. $arrLen . 'b', $i);
$cache = array();
for($j = 0; $j <$arrLen; $j++) {

PHP:

echo md5(file_get_contents('test.torrent'));
//e699b0e7535cebc1b10de1613d6797fb

Python:

@AlloVince
AlloVince / gist:9087216
Created February 19, 2014 06:48
Python蛋疼的Url Parser
url = urlparse.urlparse(url)._asdict()
query = urlparse.parse_qs(url['query'])
query['id'] = 1
url['query'] = urllib.urlencode(query)
url = urlparse.urlunparse(url.values())
@AlloVince
AlloVince / restfulapi.md
Last active November 9, 2020 03:05
npm install -g reveal-md && wget -q -O restful.md https://gist.githubusercontent.com/AlloVince/ba8c33138adbdd39d757/raw/restfulapi.md && reveal-md restful.md

RESTFul API 设计

@AV 2015.04


什么是REST

Representational State Transfer

gantt
dateFormat  YYYY-MM-DD
title A股项目

section 基础
数据库设计 [元素,桢航]        :active,  base_db, 2015-04-11, 3d
前端调查选型[子龙,点圈] :active, base_front, 2015-04-11, 3d
@AlloVince
AlloVince / project.md
Last active November 28, 2019 06:08
npm install -g reveal-md && wget -q -O project.md https://gist.githubusercontent.com/AlloVince/04dab3ad5c1f24c9faea/raw/project.md && reveal-md project.md

项目与产品

@AV 2015.04


目前的问题

  • 需求不明确,经常变更,缺少书面化的文档
  • 重点不明确
@AlloVince
AlloVince / gist:4ec938b41ee2142333ca
Last active August 29, 2015 14:24
RESTFul App处理逻辑
//请求成功返回2XX
if (statusCode.startWith('2')) {
//请求成功,处理业务
} else {
//5XX错误,服务器有问题
if (statusCode.startWith('5')) {
//响应格式不定,显示网络错误或未知错误给用户
} elseif (statusCode.startWith('4')) {
//4XX错误,输入有问题
//4XX错误后端必须保证错误格式
@AlloVince
AlloVince / php_code_review.md
Last active May 7, 2019 07:34
npm install -g reveal-md && wget -q -O php_code_review.md https://gist.githubusercontent.com/AlloVince/a656e2842c7b6a43c81d/raw/php_code_review.md && reveal-md php_code_review.md

PHP Code Review

2015.07.31 @AV


什么是好代码


@AlloVince
AlloVince / EvaEngine.js.md
Last active May 7, 2019 08:38
npm install -g reveal-md && wget -q -O EvaEngine.js.md https://gist.githubusercontent.com/AlloVince/cb92c08e0b1c9e5b8b4f6becae12cc5d/raw/EvaEngine.js.md && reveal-md EvaEngine.js.md

EvaEngine.js

2016-2018 @AlloVince


什么是EvaEngine.js


@AlloVince
AlloVince / graphql.md
Last active May 9, 2019 13:19
npm install -g reveal-md && wget -q -O graphql.md https://gist.githubusercontent.com/AlloVince/8ba1c92890c74cc7f4e68f09c79ec0d1/raw/graphql.md && reveal-md graphql.md

GraphQL

从入门到放弃

2018.5 @AlloVince


什么是GraphQL