This file contains hidden or 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 | |
// import | |
$ch = curl_init(); | |
$index = 'test'; // like database | |
$type = 'users'; // like table | |
$id = 1; | |
$data = array( | |
'name' => 'violetyk', |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
switchのデリミタで最初のcaseを書かないとパースエラーになる | |
<? switch(true): |
This file contains hidden or 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 | |
// PEAR タイプ | |
switch ($condition) { | |
case 1: | |
# code... | |
break; | |
default: | |
# code... |
This file contains hidden or 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
test |
This file contains hidden or 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
var start_pos = 0; | |
$(window).scroll(function(e){ | |
var current_pos = $(this).scrollTop(); | |
if (current_pos > start_pos) { | |
console.log('down'); | |
} else { | |
console.log('up'); | |
} | |
start_pos = current_pos; | |
}); |
This file contains hidden or 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
map <SID>xx <SID>xx | |
let s:sid = s:sub(maparg("<SID>xx"),'xx$','') | |
unmap <SID>xx | |
let s:file = expand('<sfile>:p') |
This file contains hidden or 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
cd /usr/local/src/ | |
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
tar xf libevent-2.0.21-stable.tar.gz | |
./configure --prefix=/usr/local/libevent2 | |
make | |
paco -D make install | |
cd /usr/local/src/ | |
wget http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz | |
tar xf tmux-1.8.tar.gz |
This file contains hidden or 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 | |
/* | |
* /posts/123 -> $id | |
*/ | |
// routes.php | |
Router::connect('/posts/*', array('controller' => 'posts', 'action' => 'view')); | |
// PostsController | |
function view($id = null) { |
This file contains hidden or 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 = 'ぱふぱふぱふぱふぱ!ぱふぱふぱふぱふぱ!ぱふぱふぱふぱふぱ!ぱふぱふぱふぱふぱ!これで50文字文字!うほ'; | |
echo $strwidth = mb_strwidth($str, 'utf-8'); | |
echo "\n"; | |
echo mb_strlen($str, 'utf-8'); | |
echo "\n"; | |
$trimmarker = ' ...'; | |
echo $trimmarker_width = mb_strwidth($trimmarker, 'utf-8'); | |
echo "\n"; |
This file contains hidden or 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 | |
$host = 'localhost'; | |
$port = 6667; | |
$nick = 'bot'; | |
$password = 'password'; | |
$channel = '#channel'; | |
$message = '日本語でおk'; | |
$fp = fsockopen($host, $port, $erno, $errstr, 30); |