Skip to content

Instantly share code, notes, and snippets.

View riaf's full-sized avatar
🏠
Working from home

Keisuke SATO riaf

🏠
Working from home
View GitHub Profile
@riaf
riaf / gist:737172
Created December 11, 2010 05:27
Twitter 検索
<?php
if (isset($argv[1])) {
$word = rawurlencode($argv[1]);
} else {
echo <<<USAGE
Usage:
php {$argv[0]} SEARCH_WORD [ > OUTPUT ]
USAGE;
<?php
require_once '/home/fivestar/projects/vendor/symfony-project.org/branches/1.4/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
class ProjectConfiguration extends sfProjectConfiguration
{
protected $annotationCache;
public function setup()
<?php
/**
* 再帰的に scandir する
*
* @author Keisuke SATO <[email protected]>
**/
function recursive_scandir($path, $result=array()) {
if (is_dir($path)) {
$path = rtrim($path, '/'). '/';
$dirs = array_diff(scandir($path), array('.', '..'));
@riaf
riaf / Niigata.php
Created November 16, 2010 06:36
読めるけど書けない
<?php
/**
* Niigata Class
*
* @author Keisuke SATO aka riaf <[email protected]>
* @license New BSD License
**/
class Niigata
{
protected $_niigata_ = array();
@namespace url(http://www.w3.org/1999/xhtml);
.xdebug-var-dump {
padding: 4px 8px;
margin: 5px 10px;
font-family: Menlo, Monaco, "Consolas", "Lucida Console", "courier new" !important;
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
-o-border-radius: 10px !important;
border-radius: 10px !important;
@riaf
riaf / __common__.php
Created October 5, 2010 02:21
deprecated. see jp.riaf.util.AutoLoader
<?php
// TODO: Store をクリアする何かが必要
spl_autoload_register(function($name) {
$store_key = array(__DIR__, '__autoload');
if (App::mode() == 'release' && Store::has($store_key)) {
$files = Store::get($store_key);
} else {
$files = array();
$dir = 'libs/';
@riaf
riaf / .gitignore
Created September 28, 2010 04:03
Lightning Template
cache
<?php
require_once 'Services/Twitter.php';
require_once 'HTTP/OAuth/Consumer.php';
try {
$twitter = new Services_Twitter();
// コマンドラインで叩くくらいならば,OAuth の鍵は全部定義しちゃってもいいかな..とか。
// ウェブアプリにするならば,きちんと authorize するべきですね。
$oauth = new HTTP_OAuth_Consumer(
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>twitter search</title>
<style type="text/css">
body {
color: #333;
}
img {
<?php
$url = 'http://***.php';
$data = array(
'channel' => '***',
'message' => 'ほげらほげら',
'password' => '***',
);
$options = array(
'http' => array(