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
var | |
preFunc = null, | |
preInput = '', | |
input = '', | |
ajaxPost = function(input) { | |
// apiコール | |
}; | |
$('#ajax_form').on('keyup', function() { |
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
(defmacro append-to-list (mode-list &rest body) | |
(let ((lst (gensym))) | |
`(dolist (,lst ',body) | |
(add-to-list ,mode-list ,lst)))) | |
; Unit Test | |
(dont-compile | |
(require 'ert) | |
(require 'cl) |
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
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t) | |
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t) | |
(add-to-list 'process-coding-system-alist '("gosh" utf-8 . utf-8)) | |
(setq scheme-program-name "/usr/local/bin/gosh -i") | |
(defun scheme-other-windows () | |
(interactive) | |
(save-selected-window | |
(select-window (split-window-horizontally)) |
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
hash = [{id: 1, name: 'taro', old: 22, sex: 'men'}, | |
{id: 2, name: 'hanako', old: 22, sex: 'woman'}, | |
{id: 3, name: 'taro', old: 24, sex: 'men'}, | |
{id: 4, name: 'taro', old: 24, sex: 'woman'}, | |
{id: 5, name: 'taro', old: 22, sex: 'woman'}, | |
] | |
p hash.uniq { |h| [h[:name], h[:old]] } | |
# => [{:id=>1, :name=>"taro", :old=>22, :sex=>"men"}, {:id=>2, :pname=>"hanako", :old=>22, :sex=>"woman"}, {:id=>3, :name=>"taro", :old=>24, :sex=>"men"}] |
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 one-line-comment () | |
(interactive) | |
(save-excursion | |
(beginning-of-line) | |
(set-mark (point)) | |
(end-of-line) | |
(comment-or-uncomment-region (region-beginning) (region-end)))) |
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
ary = [1, 10, 2, 5, 8, 4, 6] | |
ary.each_with_index.max[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
a = {c: 3, b: 2, dd: 5, a: 1} | |
p a.sort.to_h |
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
# メソッド内で | |
value = foo_method | |
return if value.nil? | |
# 下でも一緒 | |
value = foo_method.tap { |e| return if e.nil?} |
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
AllCops: | |
Exclude: | |
- 'db/schema.rb' | |
- 'vendor/**/*' | |
- 'db/migrate/**/*' | |
Metrics/LineLength: | |
Max: 120 | |
Metrics/CyclomaticComplexity: |
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
require 'forwardable' | |
class A | |
extend Forwardable | |
def_delegators :@ary, :size, :[]=, :[], :<<, :to_s, :inspect | |
def initialize | |
@ary = [] | |
end | |
end |
OlderNewer