Skip to content

Instantly share code, notes, and snippets.

View co3k's full-sized avatar
🔞
"><s>'\

Kousuke Ebihara co3k

🔞
"><s>'\
View GitHub Profile
<?php
set_include_path('/path/to/oauth');
require_once 'OAuth.php';
define('CONSUMER_KEY', '');
define('CONSUMER_SECRET', '');
define('BASE_URL', 'https://twitter.com');
define('REQUEST_TOKEN_URL', BASE_URL.'/oauth/request_token');
AdminUser:
<?php for ($i = 0; $i < 100; $i++) : ?>
admin_user_<?php echo $i ?>:
username: "admin_<?php echo $i ?>"
password: "password"
<?php endfor; ?>
Member:
<?php for ($i = 1; $i <= 100; $i++) : ?>
member_<?php echo $i ?>:
<?php
define('SNS_TITLE', 'MySNS');
define('FEED_URL', 'http://example.com/api.php/feeds/diary');
define('APPEND_CDATA_TO_CONTENT', true);
// ---
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
<?php
require_once 'OAuth.php';
require_once 'OpenPNEOAuth.class.php';
// config
define('CONSUMER_KEY', ''); // コンシューマキー
define('CONSUMER_SECRET', ''); // コンシューマシークレット
define('BASE_URL', 'http://sns.example.com/'); // SNS の URL (最後は / で終わる必要があります)
define('SCRIPT_URL', 'http://externals.example.com/oauth_sample.php'); // このスクリプトの URL
<?php
/**
* Copyright 2009 Kousuke Ebihara
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/
@co3k
co3k / trac_to_redmine.py
Created October 5, 2009 08:22
trac から redmine のチケットをインポートするやつ
# -*- coding: utf-8 -*-
import xmlrpclib, urllib, urllib2, cookielib, datetime
xmlrpc_url = 'http://user:pass@trac.openpne.jp/login/xmlrpc'
login_url = 'http://redmine.openpne.jp/login'
login_account = {'username': 'user', 'password': 'pass'};
newticket_url = 'http://redmine.openpne.jp/projects/op3/issues/new';
def convert_type(type):
@co3k
co3k / commit-msg
Created October 6, 2009 08:34
git コミット時にチケット番号の記述を強制する奴
#!/bin/sh
if grep "\(refs\|fixes\) #[0-9]\+" $1 > /dev/null; then
ticket=$(sed -e "s/.*\(fixes\|refs\) #\([0-9]\+\).*/\2/" .git/COMMIT_EDITMSG | line)
title=$(curl -s "http://redmine.openpne.jp/issues/$ticket" | sed -n "/<title>/p" | sed "s/<title>\(.\+\)<\/title>/\1/")
if [ "404 - OpenPNE Issue Tracking System" = "$title" ]; then
echo "The specified ticket #$ticket is undefined."
exit 1
fi
@co3k
co3k / ebi.php
Created October 20, 2009 08:44
php の call time pass by reference を見る奴
<?php
echo 'PHP Version: '.phpversion().PHP_EOL;
echo 'allow_call_time_pass_reference: '.(int)ini_get('allow_call_time_pass_reference').PHP_EOL;
echo '============================='.PHP_EOL.PHP_EOL;
function ref(&$arg)
{
$arg = 'kani';
}
@co3k
co3k / HelperTwigExtension.php
Created October 26, 2009 05:28
Twig で symfony のヘルパー関数を超強引に使えるようにする Extension (HelperTokenParser はもっと簡単に書けた。後で直す)
<?php
class HelperTwigExtension extends Twig_Extension
{
static protected $helpers = array();
public function getTokenParsers()
{
if (empty(self::$helpers))
{