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
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/vundle.git/ | |
| call vundle#rc() | |
| Bundle 'quickrun.vim' | |
| Bundle 'neocomplcache' |
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('simpletest/autorun.php'); | |
| require_once('Calc.php'); | |
| class TestOfCalc extends UnitTestCase { | |
| function testCalcAdd() { | |
| $calc = new Calc(); | |
| // 1 + 1 = 2 | |
| $this->assertEqual($calc->add(1,1), 2); |
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
| require 'rake' | |
| require 'rspec/core/rake_task' | |
| # RSpec::Core::RakeTask.new(:spec) | |
| # task :default => :spec | |
| task :default do | |
| filelist = FileList['spec/*_spec.rb'].join(' ') | |
| sh "bundle exec rspec #{filelist}" | |
| end |
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
| var wPat = "[a-zA-Z0-9-]"; // 英数字・ハイフン | |
| wPat += "|[\u3041-\u3093]"; // ひらがな | |
| wPat += "|[\u30A1-\u30F6]"; // カタカナ | |
| wPat += "|[・ヽヾゝゞ々ー]"; // 記号 | |
| wPat += "|[\u4E00-\u9FFF]"; //漢字 | |
| wPat = "^(" + wPat +")+$"; | |
| if (!str.match(wPat)) { | |
| 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 | |
| define('FOO', 1); | |
| define('BAR', 2); | |
| // 変数展開が「{$」で始まっている場合、関数の実行等が可能です。 | |
| $c = 'constant'; | |
| echo "FOO: {constant('FOO')}, BAR: {constant('BAR')}" . PHP_EOL; // => FOO: 1, BAR: 2 |
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
| <script> | |
| var Obj = function(){ | |
| var background = "#fff"; | |
| var state = "on"; | |
| this.change_state = function(){ | |
| if(state === "on"){ | |
| state = "off"; | |
| background = "#000"; | |
| } else { | |
| state = "on"; |
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
| window.onerror = function(message, url, linenumber) { | |
| alert("JavaScript error: " + message + " on line " + linenumber + " for " + url); | |
| } |
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
| window.onerror = function(message, file, lineNumber) { | |
| new Image().src = "/this_url_doesnt_exist?message=" | |
| encodeURIComponent(message) | |
| "&file=" + encodeURIComponent(file) | |
| "&lineNumber=" + encodeURIComponent(lineNumber); | |
| }; |
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
| window.onerror = function(message, file, lineNumber) { | |
| _gaq.push([ | |
| '_trackEvent', | |
| 'error', | |
| file + ':' + lineNumber, | |
| message + '' | |
| ]); | |
| }; |
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 | |
| $userAgent = $_SERVER['HTTP_USER_AGENT']; | |
| $isMobile = false; | |
| if (preg_match("/Android/", $userAgent, $match)) { | |
| $isMobile = true; | |
| } | |
| if (preg_match("/iPhone/", $userAgent, $match)) { |
OlderNewer