View isTargetPage.js
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(window) { | |
var app = function() {}; | |
// 動作対象ページか判定する。controller名、action名で判定する | |
// どちらか片方指定, 両方指定どちらでも可。 | |
app.prototype.isTargetPage = function(targetHash) { | |
if (!this.hasValidArgument(targetHash)) { | |
return false; | |
} |
View compare_version.js
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 availableVersion = 4.2; // 4.2以上を対象とする | |
var userVersion = '4.4.0.10'; | |
var numList = userVersion.split('.'); | |
var version = numList.slice(0, 2).join('.'); | |
console.log(version); // => "4.4" | |
console.info(typeof version); // => string | |
version = parseFloat(version, 10); |
View 0_reuse_code.js
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 |
View othello.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<title>おせろ</title> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<style> |
View file_write_in_try-catch.php
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 | |
// 結果:例外なげてもファイルに書き込まれる | |
try { | |
$fp = fopen('./fugafuga.log', 'a'); | |
fwrite($fp, '123'); | |
fclose($fp); | |
throw new Exception('e'); | |
} | |
catch(Exception $e) { |
View 0017.py
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
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
import sys, string | |
alphabet = 'abcdefghijklmnopqrstuvwxyza' | |
table = string.maketrans(alphabet[:-1], alphabet[1:]) | |
for s in sys.stdin: | |
while not('the' in s or 'this' in s or 'that' in s): | |
s = s.translate(table) |
View keycode_check.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Untitled Document</title> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script> | |
$(function(){ | |
$('#target').on({ | |
keyup : function(e){ |
View gist:fd08bb4fac4161fa4902
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
(NeoBundleUpdate時にエラー) | |
[neobundle/install] ( 2/39): |vimproc| git pull --rebase && git submodule update --init --recursive | |
function neobundle#commands#install..<SNR>27_install..neobundle#installer#sync..neobundle#installer#get_revision_number..neobundle#util#system..vimpro | |
c#system..<SNR>113_system..vimproc#pgroup_open..<SNR>113_pgroup_open..vimproc#plineopen3..<SNR>113_plineopen..<SNR>113_convert_args..vimproc#get_comma | |
nd_name の処理中にエラーが検出されました: | |
行 5: | |
E119: Not enough arguments for function: vimproc#filepath#which | |
E116: 関数の無効な引数です: vimproc#util#substitute_path_separator( vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n') | |
E116: 関数の無効な引数です: substitute(vimproc#util#substitute_path_separator( vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n') |
View filickr_credit_mobile.js
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 title,a, | |
divs = document.getElementsByTagName('div'), | |
len = divs.length; | |
for(var i=0;i<len;i++){ | |
if(divs[i].className.match(/photo_meta/)){ | |
title = divs[i].getElementsByTagName('h2')[0].childNodes[0].nodeValue.replace(/ /g, '').replace(/\t/g, '').replace(/\n/g, ''); | |
break; | |
} | |
} |
View flickr_credit_pc.js
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 a,title, | |
divs = document.getElementsByTagName('div'), | |
len = divs.length; | |
for(var i=0;i<len;i++){ | |
if(divs[i].className == 'attribution-info'){ | |
a = divs[i].getElementsByTagName('a')[0]; | |
break; | |
} | |
} |
NewerOlder