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 | |
// https://github.com/facebook/php-sdk/ | |
require_once 'path/to/facebook.php'; | |
// http://www.kigkonsult.se/iCalcreator/ | |
require_once 'path/to/iCalcreator.class.php'; | |
$config = array( | |
'appId' => 'xxxx',//change to your fb app id | |
'secret' => 'yyyy',//change to your fb app secret | |
'pageId' => 'shimokitazawa.osscafe',//change to target fb page id |
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
//<input type="checkbox" name="sample[]" value="1" checked="checked" /> | |
//<input type="checkbox" name="sample[]" value="2" /> | |
//<input type="checkbox" name="sample[]" value="3" checked="checked" /> | |
var str = $('input:checkbox[name="sample[]"]:checked').map(function(i){ return this.value }).get().join(', '); | |
alert(str);//1, 3 |
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
String.prototype.cnvPhone = function(defaultPrefix){ | |
var str0 = this, str1, str; | |
str1 = str0.replace(/[^\d]/g, ''); | |
if (defaultPrefix && /^[^0]/.test(str1)) str1 = defaultPrefix+str1;//0以外で始まる場合、デフォルトの局番を追加 | |
str = str1; | |
str = str.replace(/^0(9969|9913|9912|9802|9496|8636|8514|8512|8477|8396|8388|8387|7468|5979|5769|4998|4996|4994|4992|1658|1656|1655|1654|1648|1635|1634|1632|1587|1586|1564|1558|1547|1466|1457|1456|1398|1397|1392|1377|1374|1372|1267)(\d)(\d{4})$/, "0$1-$2-$3");//固定電話市外4桁 | |
str = str.replace(/^0(997|996|995|994|993|987|986|985|984|983|982|980|979|978|977|974|973|972|969|968|967|966|965|964|959|957|956|955|954|952|950|949|948|947|946|944|943|942|940|930|920|898|897|896|895|894|893|892|889|887|885|884|883|880|879|877|875|869|868|867|866|865|863|859|858|857|856|855|854|853|852|848|847|846|845|838|837|836|835|834|833|829|827|826|824|823|820|799|798|797|796|795|794|791|790|779|778|776|774|773|772|771|770|768|767|766|765|763|761|749|748|747|746|745|744|743|742|740|739|738|737|736|735|725|721|599|59 |
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
SELECT | |
YEAR(NOW()) - YEAR(birthday) - IF(DATE_FORMAT(birthday, '%m%d') > DATE_FORMAT(NOW(), '%m%d'), 1, 0) | |
AS "age" | |
FROM a_table |
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 | |
/** | |
* curl_get_contents | |
* | |
* $url = 'http://somewhere.dom/' | |
* $response = curl_get_contents($url); | |
*/ | |
function curl_get_contents($url){ | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
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
cd /path/to/somewhere | |
find . -exec touch -t 11012250000.00 {} \; |
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
UPDATE user SET user_password = MD5( CONCAT( user_id, '-', MD5( 'NEWPASS' ) ) ) WHERE user_id =1 | |
#http://kb.siteground.com/article/How_to_reset_my_MediaWiki_admin_password.html |
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
function byte2str($size){ | |
$kb=1024; | |
$mb=1048576; | |
$gb=1073741824; | |
$tb=1099511627776; | |
if(!$size) return '0 B'; | |
elseif($size<$kb) return $size.' B'; | |
elseif($size<$mb) return round($size/$kb, 0).' KB'; | |
elseif($size<$gb) return round($size/$mb, 2).' MB'; | |
elseif($size<$tb) return round($size/$gb, 2).' GB'; |
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 | |
/** | |
* PDFファイルのリンクに、容量を記載するためのスクリプト | |
* @author Tsutomu Kawamura <kawamura@cognitom.com> | |
* @copyright Copyright (c) 2012, Tsutomu Kawamura | |
*/ | |
/** | |
* メイン | |
*/ |
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
zip -r Archive.zip TargetDirectory -x "*.DS_Store" |
OlderNewer