Skip to content

Instantly share code, notes, and snippets.

View k1LoW's full-sized avatar
🦓

Ken’ichiro Oyama k1LoW

🦓
View GitHub Profile
;; #+:Emacs
(defun unicode-unescape-region (start end)
"指定した範囲のUnicodeエスケープ文字(\\uXXXX)をデコードする."
(interactive "*r")
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(while (re-search-forward "\\\\u\\([[:xdigit:]]\\{4\\}\\)" nil t)
(replace-match (string (unicode-char
(string-to-number (match-string 1) 16)))
@hiromi2424
hiromi2424 / webroot_controller.php
Created January 7, 2011 14:20
webroot controller
<?php
class WebrootController extends AppController {
var $uses = null;
var $_ext = '.php';
function show() {
$path = func_get_args();
$path = implode(DS, $path);
if (in_array($path, array('index', 'css', 'test'))) {
@kunit
kunit / オブジェクト案のテスト
Created January 21, 2011 08:21
最低限度のもの
<?php
class Escaper {
public $value = null;
public $raw = null;
public function __construct($value, $charset = 'UTF-8') {
$this->value = htmlspecialchars($value, ENT_QUOTES, $charset);
$this->raw = $value;
}
public function __toString() {
@Jxck
Jxck / map.js
Last active April 10, 2020 03:36
Hadoop Streaming with Node.js
#!/usr/bin/env node
var stdin = process.openStdin();
var stdout = process.stdout;
var input = '';
stdin.setEncoding('utf8');
stdin.on('data', function(data) {
if (data) {
input += data;
@junichi11
junichi11 / youtube_controller.php
Created June 24, 2011 06:58
CakePHP Zend GData Youtube unlisted upload
<?php
class YoutubeController extends AppController{
public $name = 'Youtube';
public $uses = array();
public $layout = 'default';
public $components = array('Zend','Auth');
public function upload(){
$this->Zend->loadClass('Zend_Gdata_ClientLogin');
@hiromi2424
hiromi2424 / AppController.php
Created July 2, 2011 06:18
TwitterKit.TwitterOauthAuthenticate design
<?php
class AppController extends Controller {
public $components = array(
'Auth' => array(
'authenticate' => array(
'TwitterKit.TwitterOauth',
),
),
@slywalker
slywalker / pagination.ctp
Created October 5, 2011 07:25
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@kaz29
kaz29 / cakephp2_on_nifyucloud_centos5_6.sh
Created October 13, 2011 16:40
CakePHP2.0.0 setup on NiftyCloud CentOS5.6
#!/bin/sh
CAKEPHP_PAH=/usr/local/app
if [ ! -d $CAKEPHP_PAH ]
then
mkdir $CAKEPHP_PAH
fi
# IPアドレスを取得
IPADDR=`ip addr show | grep eth0 | grep 'inet *' | awk '{print $2;}' | cut -f1 -d '/'`
@kanreisa
kanreisa / app.js
Created November 28, 2011 07:14
node.js / socket.io SSL接続サンプル (サーバ, クライアント)
var PORT = 10443;
var SSL_KEY = '___.key';
var SSL_CERT= '___.cert';
var fs = require('fs');
var io = require('socket.io').listen(PORT, {
key : fs.readFileSync(SSL_KEY).toString(),
cert : fs.readFileSync(SSL_CERT).toString()
});
@kozo
kozo / CakePHP2-mergeVars
Created January 27, 2012 09:01
CakePHP2-mergeVars
/**
* コンストラクタ
*
* @access public
* @author sakuragawa
*/
public function __construct($request = null, $response = null) {
// サブクラスのメンバをマージする
$this->__mergeSubClass();