Skip to content

Instantly share code, notes, and snippets.

Avatar
🐵

Austin Lee lizheming

🐵
View GitHub Profile
@lizheming
lizheming / LoginController.js
Last active Aug 29, 2015
Github oAuth 登陆模块附 ThinkJS 示例
View LoginController.js
var github = reguire("./github.js")({
client_id: "xxxx",
client_secret: "oooo",
redirect_uri: "http://xxx.com/login/callback" //和申请 KEY 时填写的 CALLBACK 地址要一样
});
module.exports = Controller({
indexAction: function() {
this.end('<a href="'+github.getAuthorizeUrl()+'">Login with Github</a>');
},
@lizheming
lizheming / stringToPyin.php
Last active Aug 29, 2015
汉字转拼音,不考虑多音字的情况。
View stringToPyin.php
<?php
class dict {
private $_dict;
function __construct() {
/** 设置字典库 */
$this->_dict = array(
'A' => array(59371,41648,50400,33157,41392,18661,47599),
'Ai' => array(19697,32178,35504,36856,20712,25068,28663,26608,29399,19381,17099,47497,30339,43240,54250,56459,45201,25005,57749,17131,36057,28596,49375,29162,55685,31713,27114,64665,19190,56536,37508,22145,59104,42373,18930,17311,30185,29599,54922,60552,35971,19670,27069,47505,56476,52365,63875,43184,17031,45460,45466,43440,32176,44464,57310,36230,41904,42672,42928,42416,42160,18330,22758,52719,58012,27797,45716,44208,44720,23788,45302,25559,49645,30387,51430,56208,24969,51680,44976,16588,46209,43696,43952,18334,57994,29916,51424,34439),
'An' => array(63223,39405,58764,17125,31621,34691,56712,18059,46512,33240,42376,22239,20462,39914,36586,64753,21940,18566,20963,29912,29649,37368,23685,26617,22193,47024,25589,19441,40169,36845,45488,29099,29640,37881,24205,61928,55010,17352,50928,36553,22468,30127,3
@lizheming
lizheming / huafei.php
Created Nov 11, 2014
某个不知名的公众号强化费的方法
View huafei.php
<?php
function p($url, $fansid = "311076") {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POSTFIELDS, array(
"rid" => "3",
"fansid" => $fansid
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
try {
$res = curl_exec($curl);
@lizheming
lizheming / baidu.map.bookstore.spider.js
Last active Aug 29, 2015
百度地图书店搜索结果抓取
View baidu.map.bookstore.spider.js
function getPages( total ) {
var url = "http://ditu.baidu.com/?newmap=1&reqflag=pcmap&biz=1&pcevaname=pc2&da_par=direct&qt=s&from=webmap&da_src=pcmappg.poi.page&wd=%E4%B9%A6%E5%BA%97&c=131&sug=0&ie=utf-8&wd2=&l=12&src=7&pn=1&db=0&on_gel=1&gr=3&addr=0&nn=";
var start = 0, urls = [];
do {
urls.push( url + start );
start += 10;
} while( start < total );
return urls;
}
function getScript(url) {
View api.php
<?php
define(P2_PATH,'http://pagecookery.net/'); //输入你的PageCookery地址,不要忘记最后的"/"哦!
include("config.php");
mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PSSWORD) or
die("Could not connect: " . mysql_error());
mysql_select_db(DATABASE_DB_NAME);
View read.php
<?php
define(P2_PATH,'http://pagecookery.net/'); // please change to your P2 path, remember the ending slash.
function pcurl($url,$postargs=false)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
View quote_code.php
<code lang="php">
<?php
require_once("read.php"); //如果不是在首页调用的话则read.php替换为"你的typecho地址+read.php"
echo readit();
?>
</code>
View quote_code_by_austion.php
//这个是调用文件,具体看代码第4行就知道是哪段代码了
<div class="widget">
<div id="twitter"><img src="http://blog.imnerd.org/T.png"></div>
<div class="pagecookery">
<?php
require_once("read.php");
echo readit();
?>
</div>
</div>
View pagecookery_list.css
.pagecookery_list {
list-style-type:disc;
font-size:14px;
color:#666666;
line-height:1.7;
font-family:Georgia,Times,"Times New Roman",serif;
}
.pagecookery_list li {
border-bottom:1px dashed #CCCCCC;
list-style-type:none;
View rss_update.php
<?php
ob_start();
$entry = $SQL->RunQuery("SELECT * FROM entry ORDER BY time DESC LIMIT 0, 50");
$title = SITE_NAME . ' - RSS';
echo urldecode('%3C%3Fxml+version=%221.0%22+encoding=%22utf-8%22%3F%3E');
?><rss version="2.0">
<channel>
You can’t perform that action at this time.