Skip to content

Instantly share code, notes, and snippets.

View marcy's full-sized avatar

Masashi Oyamada marcy

View GitHub Profile
@marcy
marcy / fish.conf
Created July 28, 2016 05:04
fishshell で Enter 押したときに ls と git status を表示する ref: http://qiita.com/marcy_o/items/d51773cdd110d77cfdd8
function do_enter
set -l query (commandline)
if test -n $query
echo
eval $query
commandline ''
else
echo
ls
@marcy
marcy / file0.txt
Created June 23, 2016 04:53
Emacs でファイル保存時にインデントして行末の空行消す ref: http://qiita.com/marcy_o/items/a3e9f99baa07d16bef95
(add-hook 'before-save-hook
'(lambda ()
(delete-trailing-whitespace)
(indent-region (point-min) (point-max))))
package main
import "fmt"
func main(){
for i := 1; i <= 30; i++ {
fizz := (i % 3 == 0)
buzz := (i % 5 == 0)
if fizz { fmt.Printf("fizz") }
package main
import (
"fmt"
"time"
)
var (
jaWeekdays = []string{"日", "月", "火", "水", "木", "金", "土"}
)
@marcy
marcy / file1.txt
Created August 22, 2014 09:50
カレントバッファの内容をEvernoteへ ref: http://qiita.com/marcy_o/items/9633d46aa5f6460cdb4b
(defun toevernote ()
(interactive)
(shell-command (concat "/path/to/toevernote.rb " (buffer-file-name))))
@marcy
marcy / dev.zsh-theme
Created March 8, 2014 02:31
dev oh-my-zsh theme
# vim:ft=zsh ts=2 sw=2 sts=2
rvm_current() {
rvm current 2>/dev/null
}
rbenv_version() {
rbenv version 2>/dev/null | awk '{print $1}'
}
@marcy
marcy / 04-04-121421.el
Created April 4, 2013 09:35
ミニバッファからファイルに文字列保存
(defvar htwi-dir "/tmp/")
(with-current-buffer (get-buffer-create "htwi")
(let ((fname (concat htwi-dir (format-time-string "%Y-%m-%d") ".howm")))
(erase-buffer)
(if (file-exists-p fname)
(insert-file-contents fname))
(goto-char (point-max))
(insert (format-time-string "%H:%M:%S")
(format-time-string " ")
@marcy
marcy / 03-29-125722.rb
Created April 4, 2013 09:25
hoge=Hoge.first
module Rails
module ConsoleMethods
def tload
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
begin
klass = Object.const_get(table.classify)
class_eval do
define_method("#{klass.to_s.downcase}") do
klass.first
@marcy
marcy / ruby-200p0-test.rb
Created March 14, 2013 09:56
ruby-2.0.0 のテスト
def aaa(a: "a", b: "b")
p [a, b]
end
aaa(a: "1", b: "2")
aaa(a: "1")
aaa(b: "1")
p (1..10000000).lazy.select{|i|i%2==0}.first(3)
@marcy
marcy / git_log_author.sh
Created March 15, 2012 04:45
git Authorをcommit数順に出す
git log | grep -e "^Author: " | awk '{print $2}'| sort | uniq -c | sort -nr