Skip to content

Instantly share code, notes, and snippets.

View suneo3476's full-sized avatar

suneo3476 suneo3476

  • Hamamatsu, Shizuoka, Japan
View GitHub Profile
//step1
(ScriptRunner=function(v){var i,n,l,p,c={},w=window,t=setTimeout;for(i=0,n=v.length;i<n;++i){l=v[i];if(typeof l=='string'||l instanceof String){l={'':l}}for(p in l){if(p){if(w[p]){continue}c[p]=1}(function(j){var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=j;t(function(){document.documentElement.appendChild(s)},0)})(l[p])}}return function(f){if(f){t(function(){for(p in c){if(!w[p]){return t(arguments.callee,99)}}f()},0)}return arguments.callee}})([{jQuery: 'https://code.jquery.com/jquery-2.2.4.min.js'},{vue: 'https://cdn.jsdelivr.net/vue/1.0.24/vue.min.js'}])
//step2
(function(){$(document).ready(function(){var css = ["#4A3C94","#BF3559","#4DAB38"];$("h1:last").after("<h2>もくじリスト</h2><ul id='header_list'></ul>");$("td").each(function(){var description = "",$td = $(this),$a = $td.children("a");$.ajax({url: $a.attr("href"),type: 'GET',dataType: 'html',}).done(function(data) {$(data).find( "h1,h2,h3,h4,h5,h6" ).each(function(){description += " - " + $(this).text();}
@suneo3476
suneo3476 / header_list_ver2.js
Created June 13, 2016 16:25
使い方 ①CS演習の「2016年度1年生のページ」を開く ②F12又は「Ctrl+Shift+J」で開発用タブを開く ③「コンソール」「console」みたいなタブを開く ④アンカーが点滅している場所に、以下のスクリプトを step1 step2 の順にコピペしてエンター ⑤リストっぽいものが表示されたら開発用タブを「×」ですぐ閉じる
//step1
(ScriptRunner=function(v){var i,n,l,p,c={},w=window,t=setTimeout;for(i=0,n=v.length;i<n;++i){l=v[i];if(typeof l=='string'||l instanceof String){l={'':l}}for(p in l){if(p){if(w[p]){continue}c[p]=1}(function(j){var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=j;t(function(){document.documentElement.appendChild(s)},0)})(l[p])}}return function(f){if(f){t(function(){for(p in c){if(!w[p]){return t(arguments.callee,99)}}f()},0)}return arguments.callee}})
([
//Javascript内で外部ライブラリを呼び出すための指定
{jQuery: 'https://code.jquery.com/jquery-2.2.4.min.js'},
{vue: 'https://cdn.jsdelivr.net/vue/1.0.24/vue.min.js'}
])
//step2
(function(){
$(document).ready(function(){
@suneo3476
suneo3476 / header_list.js
Created June 8, 2016 12:23
使い方 ①CS演習の「2016年度1年生のページ」を開く ②F12又は「Ctrl+Shift+J」で開発用タブを開く ③「コンソール」「console」みたいなタブを開く ④アンカーが点滅している場所に、以下のスクリプトをコピペしてエンター ⑤しばらく待つとページにもくじリストが生成される
(ScriptRunner=function(v){var i,n,l,p,s,c={},w=window,t=setTimeout;for(i=0,n=v.length;i<n;++i){l=v[i];if(typeof l=='string'||l instanceof String){l={'':l}}for(p in l){if(p){if(w[p]){continue}c[p]=1}s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=l[p];document.documentElement.appendChild(s)}}return function(f){if(f){t(function(){for(p in c){if(!w[p]){return t(arguments.callee,99)}}f()},0)}return arguments.callee}})
([
//Javascript内で外部ライブラリを呼び出すための指定
{jQuery: 'https://code.jquery.com/jquery-2.2.4.min.js'},
{$: 'https://code.jquery.com/jquery-2.2.4.min.js'},
{vue: 'https://cdn.jsdelivr.net/vue/1.0.24/vue.min.js'}
])
(function(){
$(document).ready(function(){
//学科色(うらやましい)
@suneo3476
suneo3476 / MorphemeMapper.php
Created March 3, 2016 07:52
mysql-cli上の実行結果がPHPDatabaseObjectライブラリで再現されないバグ。DATETIME
/* ... */
function findTrend($start,$end){//期間の開始と終了を渡すと単語ランキングを返す
$stmt = $this->_pdo->prepare("
select morpheme_ID, surface_form, count(surface_form) as score
from morpheme,atc_table
where morpheme.article_ID = atc_table.article_ID
and pos = '名詞'
and tokenize_index < 10
and morpheme.article_ID in
(select article_ID from atc_table
@suneo3476
suneo3476 / ajax-in-loop.js
Created February 9, 2016 11:25
Q. $.ajax#doneで得られたdataを元にコールバック関数内で外側のループを抜けるにはどうしたらよい?
var hoge_func = function(){
var count = 0;
while(true){
var request = $.ajax({
type:"POST",
url:"getData.php",
data: {count: count}
});
request.done(function(data){
if(data == null){
@suneo3476
suneo3476 / ajax-always-return.js
Created February 4, 2016 02:48
why undefined???
var func = function(str,id){
var request = $.ajax({
type: "get",
url: "get_hogehge.php",
data: {id: id}
});
request.done(function(data){});
request.always(function(data){
var result = "仮";
console.log(result);// -> 仮
@suneo3476
suneo3476 / ssh-install.sh
Last active January 19, 2016 12:31
TeraTerm(Win7)からVirtualBox(Ubuntu14)へNAT経由でSSH接続 ref: http://qiita.com/suneo3476/items/75112d0c62e857c19fcf
sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
sudo start ssh
@suneo3476
suneo3476 / 情報学部3年生の履修問題に関するご提案
Created October 5, 2015 12:26
送信者 [email protected] 宛先 [email protected] 送信日時 2015年10月05日(月) 21:23:02
静岡大学情報学部 学生委員会
木谷友哉 先生
こんにちは。
静岡大学 総合科学技術研究科情報学専攻1年の藤森雅人です。
木谷先生は学生委員会をご担当されていたと記憶しているので、
こちらのアドレスにご連絡差し上げさせて頂きました。
本題ですが、10月初めの情報学部3年生に生じた履修に関わる問題についてです。
@suneo3476
suneo3476 / file0.txt
Created July 11, 2015 05:43
Mediawikiがデプロイ先で500エラーを起こす時に真っ先に確認すること ref: http://qiita.com/suneo3476/items/43704f0f58e194c2883f
#$wgScriptPath = "http://my.domain.com";
$wgScriptPath = "http://localhost/mwiki";
#$wgServer = "http://my.domain.com";
$wgServer = "http://localhost/mwiki";
@suneo3476
suneo3476 / log2.csv
Created July 7, 2015 14:18
https://gist.github.com/suneo3476/adec296ff079eb64617c より、引数にファイル名指定可能、複数行への対応。データは http://ncode.syosetu.com/n8073cd/3/ より。
0 綾鷹 null null
0 綾鷹 訂正事項 null null
0 綾鷹 GMの読み違えにより少々訂正いたします。 null null
0 綾鷹 『東の部屋は、錆びた鉄で出来た扉。扉に鍵はかかっているが、 null null
0 綾鷹 錆び付き脆くなっているため、少々力づくで開ければ壊せそうだ null null
1 H.H.  他は普通に鍵がかかってる? null null
0 綾鷹  (東の部屋の錆びた鉄で出来た扉 null null
0 綾鷹 …鍵がかかっているが力づくで壊せます null null
0 綾鷹 西の部屋の綺麗な木製の扉 null null
0 綾鷹 …鍵などはかかっていないので、難なく開けることが出来るでしょう null null