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 | |
function weekNumberToDate($year, $week, $wday = 1) { | |
// http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday | |
$correction = (int)gmdate('w', gmmktime(0, 0, 0, 1, 4, (int)$year)) + 3; | |
$yday = (int)$week * 7 + (int)$wday - $correction; | |
$time = gmmktime(0, 0, 0, 1, $yday, (int)$year); | |
return array((int)gmdate('Y', $time), (int)gmdate('n', $time), (int)gmdate('j', $time)); | |
} | |
var_dump(weekNumberToDate(2008, 39, 6)); |
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 | |
require_once('Zend/Validate/CreditCard.php'); | |
var_dump(getCcBrand('4980000000000006')); // => "VISA" | |
function getCcBrand($ccnum) { | |
$brands = array( | |
Zend_Validate_CreditCard::VISA => 'VISA', | |
Zend_Validate_CreditCard::MASTERCARD => 'MASTER', | |
Zend_Validate_CreditCard::JCB => 'JCB', |
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 | |
function fy_shuffle(array &$array, $rand = 'mt_rand') { | |
$array = array_values($array); | |
for($i = count($array) - 1; $i > 0; --$i) { | |
$j = $rand(0, $i); | |
if($i !== $j) { | |
list($array[$i], $array[$j]) = array($array[$j], $array[$i]); | |
} | |
} | |
return 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 | |
function smarty_function_csrf_token(array $params, Smarty_Internal_TemplateBase $smarty) { | |
$req = Yii::app()->getRequest(); | |
return | |
$req->enableCsrfValidation | |
? CHtml::hiddenField($req->csrfTokenName, $req->getCsrfToken()) | |
: ''; | |
} |
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
/銀枠|遺影|くりんぺ|くれんぺ|climpet|半額|モノクロ|白黒|セピア|エッジ|エッヂ|エンボス|色反転|馬|濁流|♪|(?:枠|わく|waku)\s*(∞)?\s*(\d+)?|モザイク\s*(\d+)?|(?:jubeat|ユビート|ゆびーと|指)\s*([01234]{16})?/i |
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
FileType=OuDia.1.01 | |
Rosen. | |
Rosenmei=東海道・山陽・九州新幹線 | |
Eki. | |
Ekimei=東京 | |
Ekijikokukeisiki=Jikokukeisiki_NoboriChaku | |
Ekikibo=Ekikibo_Syuyou | |
. | |
Eki. | |
Ekimei=品川 |
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
#pragma once | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <map> | |
#include <exception> | |
#include <stdexcept> | |
#include <boost/noncopyable.hpp> |
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
#include <string> | |
#include <stdexcept> | |
#define U_USING_ICU_NAMESPACE 0 // ヘッダで using namespace するな… | |
#include <unicode/normlzr.h> | |
namespace Normalizer { | |
namespace { | |
std::string normalize(const std::string &utf8, /* U_ICU_NAMESPACE:: */ UNormalizationMode mode); | |
} |
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 | |
// http://nemoa.biz/php/data.html の「アクセスカウンター」プログラム | |
$pointer=fopen("log.cgi", "r"); | |
$line = fgets($pointer); | |
fclose($pointer); | |
$nom = $line +1; | |
$fp = fopen("log.cgi","w"); |
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 | |
require_once('Zend/Date.php'); | |
$locales = array('ja_JP', 'en_US', 'en_GB'); | |
$formats = | |
array( | |
'DATE_FULL' => Zend_Date::DATE_FULL, | |
'DATE_LONG' => Zend_Date::DATE_LONG, | |
'DATE_MEDIUM' => Zend_Date::DATE_MEDIUM, |