Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# command! -nargs=* -range AlignEqual <line1>,<line2>!ruby C:\Tools\bin\runtime\AlignEqual.rb <args>
Pattern = "(.*?)(#{ARGV.size.zero? ? "=" : ARGV[0]})(.*\n)"
@Lines = STDIN.read
# get max length
$MaxLen = 0
@Lines.each_line{ |line|
$MaxLen = [$1.length, $MaxLen].max if (line =~ /#{Pattern}/)
}
# put lines
@nocd5
nocd5 / ccchart.js.diff
Created March 4, 2015 04:34
wsThinOutInterval = 0でも間引かれる
diff --git a/ccchart.js b/ccchart.js
index d0d5918..38b9353 100644
--- a/ccchart.js
+++ b/ccchart.js
@@ -2608,7 +2608,9 @@ window.ccchart =
//wsの受信データを間引く
//itは_wメソッド内のthat.wsuids[uid]
//console.log(it.wsIncomingCounter)
- if(it.wsIncomingCounter++ === 0){
+ if (interval === 0){
@nocd5
nocd5 / nyagos_panic_回避.diff
Created June 10, 2015 07:43
nyagos panic 回避
diff --git a/interpreter/interpreter.go b/interpreter/interpreter.go
index b8e8633..9abf8c6 100644
--- a/interpreter/interpreter.go
+++ b/interpreter/interpreter.go
@@ -139,9 +139,9 @@ func (this *Interpreter) Spawnvp() (NextT, error) {
var whatToDo NextT = CONTINUE
var err error = nil
- if argsHook != nil {
- this.Args = argsHook(this, this.Args)
@nocd5
nocd5 / gist:df4b85bd680087473507
Last active August 29, 2015 14:23
(g)vim enc/fenc vs. carsor()/ga

環境

  • Windows8.1
  • kaoriya版 gvim 7.4.648 (32bit)

手順

確認に使用したファイル

  • UTF-8エンコードのutf-8.txt
@nocd5
nocd5 / column_mod.patch
Created June 24, 2015 12:45
the_platinum_searcherの/columnの出力をbyteから文字数に変更するパッチ
diff --git a/match.go b/match.go
index 939724e..e17cf14 100644
--- a/match.go
+++ b/match.go
@@ -51,9 +51,9 @@ func (m *Match) setMatch(pattern *Pattern, num int, s string) {
m.Line.Str = s
if m.setCol {
if pattern.UseRegexp || pattern.IgnoreCase {
- m.Col = pattern.Regexp.FindStringIndex(m.Str)[0] + 1
+ m.Col = len([]rune(m.Str[0:pattern.Regexp.FindStringIndex(m.Str)[0]])) + 1
@nocd5
nocd5 / ppt.nyagos.lua
Created June 24, 2015 12:49
ptしてpecoってvimるnyagosのlua
nyagos.alias.ppt = function(args)
local sel = nyagos.eval('pt /column ' .. table.concat(args, ' ') .. '| peco')
if (#sel == 0) then
return
end
local file, line, column = sel:match('(.*):(%d+):(%d+)')
if ((file and line and column) == nil) then
print("Error : Invalid format")
print(" -> " .. sel)
return
@nocd5
nocd5 / gist:6dd66440aec2ab78f476
Created July 18, 2015 20:33
CSharpCodeProviderサンプル

呼び出し側

using Microsoft.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Reflection;

namespace CSharpCodeProviderSample
{
@nocd5
nocd5 / tabline-dnd.patch
Last active May 6, 2016 11:05
D&D tab reordering 7.4.709 compliance
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 97ad6b0..e03295c 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2946,6 +2946,29 @@ on_select_tab(
}
/*
+ * Handle reordering the tabs (using D&D).
+ */
@nocd5
nocd5 / .nyagos
Created September 4, 2015 10:36
nyagos panic
nyagos.alias.hoge = function()
print("fuga")
end
nyagos.on_command_not_found = function(args)
nyagos.exec("hoge")
return false
end
@nocd5
nocd5 / nyagos_panic.log
Created September 13, 2015 14:49
nyagos panic log
$ alias ls="ls -l"
$ alias gvim="C:/tools/bin/gvim.exe"
$ ls | gvim - &
nyagos.go: printPrompt: length invalid: ToInteger: the value in not integer on t
he stack
Exception 0xc0000029 0x0 0x20c38 0x776d096a
PC=0x776d096a
syscall.Syscall6(0x68d02790, 0x6, 0x98308c, 0x1, 0x1, 0x0, 0x0, 0x0, 0x12404060,