Skip to content

Instantly share code, notes, and snippets.

@roowe
roowe / gist:2848998
Created June 1, 2012 05:08 — forked from zythum/gist:2848881
google收录的敏感词
@roowe
roowe / git-2.eclass
Created October 9, 2012 15:54
git wrap for portage
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.29 2012/04/03 10:32:09 pacho Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
# Donnie Berkholz <dberkholz@gentoo.org>
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
-module(erl_mysql).
%% 详细用法看测试代码
-export([insert/2,
update/2, update/3,
delete/1, delete/2, delete/3,
select/1, select/2, select/3, select/4, select/5]).
%% TODO: maybe Values need support exp?
insert(Table, FVList) when is_list(FVList) ->
-module(erl_mysql_tests).
-include_lib("eunit/include/eunit.hrl").
all_test_() ->
[insert(),
update(),
delete(),
select()].
* 正确认识递归
** 可终止性证明
如果N传负数的话,就死循环了。
sum(0) ->
0.
sum(N) when N > 0->
N + sum(N-1).
这也是上次玩家经验为什么能吃掉16G内存的原因,递归没法终止。
@roowe
roowe / gist:9251510
Created February 27, 2014 14:49
data.html
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form name="input" action="/test.php" method="post">
I have a bike:
<input type="checkbox" name="vehicle1" value="Bike" />
<br />
@roowe
roowe / gist:9251518
Created February 27, 2014 14:50
test.php
<?php
print_r($_POST);
%% 本数据结构大概目的,维护大规模数据选取小范围来随机,并定长维护,剔除老数据
-module(lists_rand).
-export([new/0, cur/1, in/2]).
-define(SIZE, 10000).
-define(CHOOSE_COUNT, 5).
-record(list_rand,{
max_size = ?SIZE,
//++ 合并两个pb结构++//
public static void mergeFromPb(object oldObj, object newObj, List<string> ignore_list = null){
if(oldObj.Equals(newObj))
return;
Type oldType = oldObj.GetType();
Type newType = newObj.GetType();
// if(oldType.Equals(newType) == false){
// return;
// }
PropertyInfo[] newInfos = newType.GetProperties();
@roowe
roowe / lib_verifying_store_receipts.erl
Created July 2, 2015 02:47
In-App Purchase Programming之Verifying Store Receipts
-module(lib_verifying_store_receipts).
-include("common.hrl").
-include("define_http.hrl").
-include("define_info_10.hrl").
-export([send/1]).
-define(APP_VERIFY_RECEIPT_URL, "https://buy.itunes.apple.com/verifyReceipt").
-define(APP_SANDBOX_VERIFY_RECEIPT_URL, "https://sandbox.itunes.apple.com/verifyReceipt").