This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Tokyo'); | |
require_once('Zend/Http/Client.php'); | |
define('AMEBA_URL', 'http://atomblog.ameba.jp/servlet/_atom/blog'); | |
request('USERNAME', 'PASSWORD'); | |
function request($user_name, $password) { | |
$client = new Zend_Http_Client(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Tokyo'); | |
require_once('Zend/Uri.php'); | |
require_once('Zend/Http/Client.php'); | |
$wsse = new AmebaWsse('USER', 'PASS'); | |
// API の URI を取得 | |
$uris = getAmebaApiUris($wsse); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <uuid/uuid.h> | |
int main(int, char *[]) { | |
uuid_t uuid; | |
uuid_generate_time(uuid); | |
char buffer[128 / 4 + 4 + 1] = {}; | |
uuid_unparse(uuid, buffer); | |
std::cout << buffer << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Xend_Service_Twitter extends Zend_Service_Twitter { | |
protected function _prepare($path) { | |
try { | |
parent::_prepare($path); | |
} catch(Zend_Uri_Exception $e) { | |
$this->_localHttpClient->resetParameters()->setUri($this->_uri->__toString()); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Tokyo'); | |
require_once('Zend/XmlRpc/Client.php'); | |
require_once('Zend/Date.php'); | |
define('BLOG_ID', '0'); // 何でもOK? | |
define('USERNAME', '********'); | |
define('PASSWORD', '********'); | |
$client = new Zend_XmlRpc_Client('http://blog.fc2.com/xmlrpc.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Text_Ngram implements Countable, SeekableIterator, ArrayAccess { | |
private | |
$text = '', | |
$chunk_size = 0, | |
$max_count = 0, | |
$charset = 'UTF-8', | |
$current = 0; // for iterator | |
public function __construct($text, $n, $charset = 'AUTO') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* マルチバイト対応 str_replace | |
* | |
* @param mixed $search 検索文字列 | |
* @param mixed $replace 置換文字列 | |
* @param mixed $subject 対象文字列 | |
* @param string $encoding 文字列のエンコーディング(省略: 内部エンコーディング) | |
* | |
* @return mixed subject 内の search を replace で置き換えた文字列 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(__FILE__) . '/mb_str_replace.function.php'); | |
$subject = '赤パジャマ青パジャマ黄パジャマ'; | |
$search = 'パジャマ'; | |
$replace = '信号'; | |
$result = mb_str_replace($search, $replace, $subject); | |
var_dump($result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* マルチバイト対応 str_replace() | |
* | |
* Release 3 update 1 | |
* | |
* Copyright (C) 2006,2007,2011,2012 by HiNa <[email protected]>. All rights reserved. | |
* | |
* LICENSE | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$subject = 'hogefuga'; | |
$table = array('hoge' => 'foo', | |
'fuga' => 'bar', | |
'piyo' => 'baz', | |
'foo' => '***', | |
'bar' => '+++', | |
'baz' => '---'); | |
$functions = array('str_replace', 'mb_str_replace'); | |
foreach($functions as $f) { |
OlderNewer