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
-- ユーザーを追加するストアドプロシージャを定義します。 | |
-- 氏名と性別名('male', 'female')を入力し、 | |
-- プロシージャ内部で性別名から性別idを引き出して追加します。 | |
DROP PROCEDURE IF EXISTS insert_user; | |
DELIMITER $$ | |
CREATE PROCEDURE insert_user(IN name TEXT, IN gender_name TEXT) | |
COMMENT "ユーザーを追加します。" | |
BEGIN | |
-- カーソルの値を受け取る変数とカーソルを定義します。 |
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
/** | |
* jQuery deserialize plugin | |
* public domain | |
* | |
* 使用例: | |
* $('form').deserialize('checkbox[]=1&checkbox[]=2&checkbox[]=3'); | |
* $('form').deserialize(location.search); | |
*/ | |
(function($){ | |
$.fn.deserialize = function(s, options){ |
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
import static java.lang.Math.*; | |
public class Main { | |
public static void main(String[] args) { | |
double r = 6378.137; // 赤道半径[km] | |
// 大垣駅(lat = 緯度, lng = 経度) | |
double lat1 = 35.366944 * PI / 180; | |
double lng1 = 136.617833 * PI / 180; |
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
<# | |
PowerShell Image module(http://archive.msdn.microsoft.com/PSImage/)のget-exif.ps1を改変して下記のプロパティを追加します。 | |
- Latitude (緯度。度表記) | |
- Longitude (経度。度表記) | |
- Name (ファイル名) | |
使用例 | |
dir "*.jpg" | get-exif | select name, latitude, longitude | export-csv out.csv | |
ライセンス |
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 | |
error_reporting(E_ALL); | |
// 通常の取得 | |
// 配列のキーに値がない場合、Notice: Undefined index が発生します。 | |
$foo = $_GET['foo']; | |
$bar = $_GET['bar']; | |
$baz = $_GET['baz']; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>jQuery Validation Pluginの簡単なサンプル</title> | |
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.min.js"></script> | |
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> | |
<script>(function(){ | |
// 標準メッセージの上書き(日本語化等)とカスタム項目のメッセージを設定します。 | |
$.extend($.validator.messages, { | |
email: 'メールアドレスの形式で入力して下さい。(例: x@example.com)', |
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 | |
class ExampleDbTest extends PHPUnit_Extensions_Database_TestCase { | |
protected $conn = null; | |
/** | |
* (non-PHPdoc) | |
* @see PHPUnit_Extensions_Database_TestCase::setUp() | |
*/ | |
public function setUp() { |
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
javascript:(function(){ | |
var sheet = []; | |
[].forEach.call(document.querySelectorAll('[id]'), function(i){ | |
var selector = i.tagName + '#' + i.id; | |
sheet.push( | |
selector + ' { outline: 1px solid #f66 }', | |
selector + '::before { ' | |
+ 'content: "' + selector + '";' | |
+ 'position: absolute; z-index: 100;' |
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 | |
define('FOO', 1); | |
define('BAR', 2); | |
// 変数展開が「{$」で始まっている場合、関数の実行等が可能です。 | |
$c = 'constant'; | |
echo "FOO: {$c('FOO')}, BAR: {$c('BAR')}" . PHP_EOL; // => FOO: 1, BAR: 2 |
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 // {app}/config/routes.php | |
/** | |
* Routes Configuration | |
* | |
* In this file, you set up routes to your controllers and their actions. | |
* Routes are very important mechanism that allows you to freely connect | |
* different urls to chosen controllers and their actions (functions). | |
* | |
* PHP versions 4 and 5 | |
* |
NewerOlder