Skip to content

Instantly share code, notes, and snippets.

"" CtrlP with current filename
command! -nargs=0 CtrlPSwitcher call s:ctrlp_switcher()
function! s:ctrlp_switcher()
try
let default_input_save = get(g:, 'ctrlp_default_input', '')
let g:ctrlp_default_input = expand('%:t:r')
call ctrlp#init(g:ctrlp_builtins)
finally
if exists('default_input_save')
@tanaka51
tanaka51 / Dockerfile
Last active September 9, 2017 04:45
a minimum rails environment with docker-compose
FROM ruby:2.4.1-alpine
ENV RAILS_ROOT /opt/app
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT
RUN set -x \
&& apk upgrade --no-cache \
&& apk add --no-cache --virtual build-dependencies \
less \
require 'open-uri'
require 'yaml'
open('https://raw.githubusercontent.com/flada-auxv/refactored-bassoon/master/config/image_urls.yml') {|f|
YAML.load(f).each_with_index{|u,i|
open("#{i}.jpg", 'w') {|f|
f.write open(u).read
}
}
}
@tanaka51
tanaka51 / vimrc
Last active December 31, 2015 14:38
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'altercation/vim-colors-solarized'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tacahiroy/ctrlp-funky'
@tanaka51
tanaka51 / main.go
Last active December 26, 2015 05:29
share a variable between some goroutines
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
const (
@tanaka51
tanaka51 / mugicha.el
Last active December 22, 2015 10:28
Emacs meets tmux!
;;; mugicha.el --- Emacs meets tmux!
;; Author: Koichi TANAKA <tanaka51.jp@gmail.com>
;; This file is *NOT* part of GNU Emacs.
;;; Code:
(eval-when-compile (require 'cl))
(defgroup mugicha nil
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000101585181, pid=636, tid=3871
#
# JRE version: 7.0_25-b15
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V [libjvm.dylib+0x2a7181]
#
@tanaka51
tanaka51 / find-cp
Created June 21, 2013 09:34
find-cp png jpg -o ~/path/to/directory
#!/usr/bin/env ruby
require 'fileutils'; include FileUtils
require 'optparse'
dest_path = ""
noop = ""
opt = OptionParser.new
opt.on('-o VAL') {|v| dest_path = v }
opt.on('-d', '--dry-run') {|v| noop = v }
@tanaka51
tanaka51 / pr.md
Created April 22, 2013 10:29 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tanaka51
tanaka51 / get_emoj.js
Created October 2, 2012 07:55
Getting emoji-code and img from using on http://www.emoji-cheat-sheet.com/
var url = "http://www.emoji-cheat-sheet.com/"
var imgs_code = "";
$('span.emoji').each(function(){
imgs_code = imgs_code + "\n" + url + $(this).data('src') + " - " + $(this).parent().text();
});
alert(imgs_code);