Skip to content

Instantly share code, notes, and snippets.

@syusui-s
syusui-s / completion_parenthesis.vimrc
Last active August 29, 2015 13:56
show invisible letters
" 括弧補完
inoremap { {}<LEFT>
inoremap [ []<LEFT>
inoremap ( ()<LEFT>
inoremap " ""<LEFT>
inoremap ' ''<LEFT>
vnoremap { "zdi^V{<C-R>z}<ESC>
vnoremap [ "zdi^V[<C-R>z]<ESC>
vnoremap ( "zdi^V(<C-R>z)<ESC>
vnoremap " "zdi^V"<C-R>z^V"<ESC>
@syusui-s
syusui-s / google_imgtab_style.user.js
Last active August 29, 2015 13:56
動くかまだ試してない
// ==UserScript==
// @name Google Image Tab Before Style
// @namespace GoogleImgTabBeforeStyle
// @description Googleの画像タブの位置を以前の位置へ移動する
// @include /^https:\/\/.*google\..*\/.*&q=.*$/
// ==/UserScript==
function imgNode(nodes) {
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i].innerText == '画像') return nodes[i];
@syusui-s
syusui-s / google_imgtab_style.js
Created February 20, 2014 08:05
とりあえず,前の位置には戻せる
javascript:function imgNode(nodes){ for(var i = 0; i < nodes.length; ++i){ if(nodes[i].innerText == '画像') return nodes[i]; } return false; } node = imgNode(document.getElementsByClassName('hdtb_mitem')); menu = document.getElementById('hdtb_msb'); menu.removeChild(node); menu.insertBefore(node, menu.childNodes[1]);
@syusui-s
syusui-s / bitbucket_merge_checker.js
Last active August 29, 2015 13:56
Bitbucketでマージできそうなやつをハイライトするやつ.ブックマークレットです.
javascript:(function (){var counts=document.querySelectorAll('td.likes span.count');for(var i=0;i<counts.length;++i){if((+counts[i].innerText)>=5){var node = counts[i].parentNode;node.style.backgroundColor = '#8F5';}}})();
(function(){window.gruppi_alert = [];func = function(){var s = document.querySelectorAll("#chat_timeline > div");if(s.length != window.gruppi_alert.length){alert("NEW MESSAGE"+document.querySelector("#group_title > h1").innerText)} window.gruppi_alert = s;}; setInterval(func, 4000);})();
class Base
CONSTANT = 1
def initialize
puts CONSTANT
end
def puts_constant_base
puts CONSTANT
end
@syusui-s
syusui-s / HelloWorld.java
Last active August 29, 2015 13:57
Java練習
import java.util.*;
import java.io.*;
import java.util.*;
import java.io.*;
class HelloWorld {
public static void main(String[] args) {
System.out.printf("Hello World!\n"); // util
System.out.println("Hello World!"); // io
@syusui-s
syusui-s / instanceof.cpp
Created March 15, 2014 04:32
C++ の instance_of
// 参考: http://simple-asta.blogspot.jp/2013/06/c-instanceof.html
#include <iostream>
class Object {
public:
template<typename T>
inline bool instance_of()
{
return dynamic_cast<const T*>(this) != 0;
}
@syusui-s
syusui-s / sixamo.patch
Created April 21, 2014 02:07
http://yowaken.dip.jp/sixamo/ をRuby2.1でもとりあえず使えるようにするpatchです.iconvで,euc-jp→utf-8に変換してやってからパッチ当ててください. $ iconv -f euc-jp -t utf-8 sixamo.rb -o sixamo-utf.rb
--- sixamo-utf.rb 2014-04-21 11:00:11.120860891 +0900
+++ sixamo-utf-fixed.rb 2014-04-21 11:01:17.724191103 +0900
@@ -4,7 +4,7 @@
# $Id: sixamo.rb,v 1.52 2007/03/05 08:31:23 hori Exp hori $
#
-$KCODE = 'e'
+# $KCODE = 'e'
# for ruby 1.6
@syusui-s
syusui-s / assembly_interpret.rb
Last active August 29, 2015 14:00
某教科書のアセンブリコードの解釈器.バグあったら教えてね.クッソ適当につくったので美しさなんて考慮してません.ライセンスは,GPLv3です.
# Assembly Interpret
# @author Shusui MOYATANI
# @license GNU General Public License version 3
$memory = []
$calreg = 0
# パースして$memoryに保存
def parse_store(str)
tmp = str.split(/\s+/)