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
import string | |
from random import randrange | |
LENGTH = 10 | |
alphabets = string.digits + string.letters | |
def randstr(n): | |
return ''.join(alphabets[randrange(len(alphabets))] for i in xrange(n)) | |
if __name__ == '__main__': |
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 | |
$sunt = mktime(0, 0, 0, date("m"), date("d")-date("w"), date("Y")); // 今週の日曜日0時の時刻 | |
for ($i = 0; $i < 7; $i++) { | |
$t = $sunt + $i * 60 * 60 * 24; //ワンステップで一日 | |
$day = date("j", $t); | |
if ($day == date("j")) { //今日の場合 | |
$day = "<b>{$day}</b>"; | |
} | |
echo " <td>{$day}</td>\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
import org.dom4j.Document; | |
import org.dom4j.DocumentException; | |
import org.dom4j.DocumentHelper; | |
public class Dom4jTest { | |
public static void main(String[] args) { | |
System.out.println("start"); | |
String xml = "<root><element name='toshi'>text1</element><element2>text2</element2></root>"; | |
try { | |
Document doc = DocumentHelper.parseText(xml); |
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 checktime($hour, $min, $sec) { | |
if ($hour < 0 || $hour > 23 || !is_numeric($hour)) { | |
return false; | |
} | |
if ($min < 0 || $min > 59 || !is_numeric($min)) { | |
return false; | |
} | |
if ($sec < 0 || $sec > 59 || !is_numeric($sec)) { | |
return false; |
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 | |
/** | |
* via: http://d.hatena.ne.jp/fbis/20070713/1184309659 | |
*/ | |
function camelize ($str) { | |
return str_replace(' ','',ucwords(str_replace('_',' ',$str))); | |
} | |
function decamelize ($str) { |
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 | |
/** | |
* via: http://nanoca.me/relaxtyle/blog/2011/07/php-1.html | |
*/ | |
// 現在表示されているファイル名取得 | |
$path=$_SERVER["PHP_SELF"]; | |
// パスつきのファイル名取得 | |
$filename=basename($_SERVER["PHP_SELF"]); |
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 | |
print "1 hour later:" . date("Y/m/d H:i:s",strtotime("1 hour" ,strtotime(now))) . "<br>"; |
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
// via: http://docs.jquery.com/How_jQuery_Works | |
$(document).ready(function(){ | |
$("a").click(function(event){ | |
alert("As you can see, the link no longer took you to jquery.com"); | |
event.preventDefault(); | |
}); | |
}); |
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 | |
$PREFECTURE = [ | |
'1' => '北海道', | |
'2' => '青森県', | |
'3' => '岩手県', | |
'4' => '宮城県', | |
'5' => '秋田県', | |
'6' => '山形県', | |
'7' => '福島県', | |
'8' => '茨城県', |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int n = 10; | |
Action<int> act = (int i) => | |
{ | |
Console.WriteLine("num is : {0}", n * i); | |
}; |
OlderNewer