Skip to content

Instantly share code, notes, and snippets.

View tyru's full-sized avatar
🏠
Working from home

Fujiwara Takuya tyru

🏠
Working from home
View GitHub Profile
#!perl -w
# usage: fetch.pl [urls...]
use strict;
use Coro;
use Coro::Select; # この行をコメントアウトすると多重化されなくなり時間がかかるようになる
use Furl;
my @coros;
foreach my $url(@ARGV) {
push @coros, async {
setlocal foldmethod=expr foldexpr=MyHelpFold(v:lnum)
setlocal foldtext=MyHelpFoldText()
function! MyHelpFold(lnum) " {{{2
let line = getline(a:lnum)
let next = getline(a:lnum + 1)
let prev = getline(a:lnum - 1)
if line =~ '^=\{78}$'
return 1
elseif next =~ '^=\{78}$'
@h1mesuke
h1mesuke / abbrev.vim
Created November 9, 2010 15:13
Vim - A port of Ruby's abbrev
"-----------------------------------------------------------------------------
" Abbrev
function! util#abbrev(words)
let table = {}
let seen = {}
for word in a:words
let abbrev = substitute(word, '.$', '', '')
let ablen = strlen(abbrev)
while ablen > 0
function! s:join(lines, ...)
return join(map(a:lines, 'substitute(v:val, "^\\s*", "", "")'), a:0 ? a:1 : '; ')
endfunction
""" Test cases
function! s:Test()
""" s:join
call s:assert(exists('*s:join'), 'function s:join does not exist')
use v6;
class Brainfuck {
has $!buf;
has $!ptr;
submethod BUILD(:$buf-size = 1024) {
$!buf = Buf.new(0 xx $buf-size);
$!ptr = 0;
}
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end

名前を言ってはいけないあのプラギン

u(ry

現代日本語圏エンジニアにおいてのヴォルデモートのような存在。名前を言うだけで呪われる。

呪われると以下のようなことが起きる

  • ブログを書くと「俺様にバグ報告するのだ!」とコメントを書かれる
  • Twitter でしつこい @ スパムがくるようになる
@agile
agile / InsertTabComplete.vim
Created January 4, 2011 16:07
drop this in ~/.vim/plugins and you can complete in insert mode using the tab key
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
@ohac
ohac / HgDrop.txt
Created January 6, 2011 10:59
HgDrop (a DropBox clone)
HgDrop (a DropBox clone)
= How To Run
$ hg init hgdrop
$ cd hgdrop
$ echo -e '[ui]\nusername = bot\n[extensions]\nzeroconf =' > .hg/hgrc
$ hg serve -p 12345 &
$ cat >.hg/hgbox.sh
while :; do
require 'yaml'
CONFIG = 'script.yaml'
yaml = YAML.load(File.read(CONFIG))
COMMAND = yaml['command']
# Normalize
yaml['scripts'].map do |s|