This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function do_enter | |
set -l query (commandline) | |
if test -n $query | |
echo | |
eval $query | |
commandline '' | |
else | |
echo | |
ls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'before-save-hook | |
'(lambda () | |
(delete-trailing-whitespace) | |
(indent-region (point-min) (point-max)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
var ( | |
jaWeekdays = []string{"日", "月", "火", "水", "木", "金", "土"} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun toevernote () | |
(interactive) | |
(shell-command (concat "/path/to/toevernote.rb " (buffer-file-name)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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}' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 " ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder