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
// comment 、 IP アドレス表記には未対応。 | |
var emailReg = /^([-!#-'*+/-9=?A-Z^-~]+(\.([-!#-'*+/-9=?A-Z^-~]+|"([!#-\[\]-~]|\\[\x00-~])+"))*|"([!#-\[\]-~]|\\[\x00-~])+")@([-!#-'*+/-9=?A-Z^-~]+(\.[-!#-'*+/-9=?A-Z^-~]+)*)$/; | |
// RFC 822 との互換性を考慮しない | |
var emailReg = /^([-!#-'*+/-9=?A-Z^-~]+(\.[-!#-'*+/-9=?A-Z^-~]+)*|"([!#-\[\]-~]|\\[\x00-~])+")@([-!#-'*+/-9=?A-Z^-~]+(\.[-!#-'*+/-9=?A-Z^-~]+)*)$/; | |
// ダブルクオート内であっても制御文字を許可しない | |
var emailReg = /^([-!#-'*+/-9=?A-Z^-~]+(\.[-!#-'*+/-9=?A-Z^-~]+)*|"([!#-\[\]-~]|\\[\x09 -~])+")@([-!#-'*+/-9=?A-Z^-~]+(\.[-!#-'*+/-9=?A-Z^-~]+)*)$/; | |
// ローカルパートにおけるピリオドの連続を許可する(ただし先頭のピリオドは許可しない) |
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
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; | |
}); |
OOP とトップダウンの構造化プログラミングの設計上の違いとしてわかりやすいのは、 フローごとの動作の差異をどこが担保するかだと思います。
決済で、キャリア決済とクレジットカードによる決済を実装しようとしたとき、 トップダウンの場合、
case payment_method
when :carrier
do_carrier_payment
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/database.php | |
class DATABASE_CONFIG | |
{ | |
var $default = array( | |
// デフォルトのDB設定... | |
); | |
// https://github.com/cakephp/datasources を導入してArraySource用のDB設定を追加します。 |
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
var SCREEN_SIZE = 500; // キャンバスのサイズ | |
var SIDE_CELLS = 200; // 一辺のセルの数 | |
var CELL_SIZE = SCREEN_SIZE / SIDE_CELLS; // 1マスの幅 | |
var FPS = 200; // フレームレート | |
var canvas; // キャンバス | |
var context; // コンテキスト | |
var dirs = [ // アリの方向用配列 | |
{'row': -1, 'col': 0}, | |
{'row': 0, 'col': 1}, | |
{'row': 1, 'col': 0}, |
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
// Original: https://github.com/gaspanik/gulpbase/ | |
var gulp = require('gulp'), | |
// 列挙するのが面倒なので、load-pluginsでプラグインをロード。何使ってるかは「package.json」で | |
$ = require('gulp-load-plugins')({ | |
pattern: ['gulp-*', 'gulp.*'], | |
replaceString: /\bgulp[\-.]/ | |
}), |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
CREATE TABLE test ( | |
day1 DATETIME, | |
day2 TIMESTAMP | |
); | |
SET SESSION time_zone = 'UTC'; | |
INSERT INTO test VALUES ('2014-12-25 00:00:00', '2014-12-25 00:00:00'); | |
SET SESSION time_zone = 'Asia/Tokyo'; | |
INSERT INTO test VALUES ('2014-12-25 00:00:00', '2014-12-25 00:00:00'); | |
SET SESSION time_zone = 'UTC'; | |
SELECT * FROM test; |
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
{ | |
/* | |
* UI関係 | |
*/ | |
// カラー&スキーマ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", // カラー | |
"theme": "Soda Dark.sublime-theme", // スキーマ | |
// カーソルのスタイル ("smooth", "phase", "blink", "wide", "solid") | |
"caret_style": "smooth", |
NewerOlder