This file contains hidden or 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
| test_data = <<eof | |
| do not match this line | |
| match this as event 1 | |
| and this a as 1 | |
| and this b as 1 | |
| do not match this line | |
| match this as event 2 | |
| and this x as 2 | |
| and this y as 2 | |
| and this z as 2 |
This file contains hidden or 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 indent-buffer () | |
| (interactive) | |
| (indent-region (point-min) (point-max))) | |
| (defun indent-region-or-buffer () | |
| (interactive) | |
| (if (use-region-p) (indent-region (region-beginning) (region-end)) | |
| (indent-buffer))) | |
| (global-set-key (kbd "C-M-/") 'indent-region-or-buffer) |
This file contains hidden or 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
| class Foo | |
| def initialize(n) | |
| @n = n | |
| end | |
| attr_reader :n | |
| def abracadabra_alakazam(x) | |
| Foo.new(n + x.n) | |
| end |
This file contains hidden or 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 indent-buffer () | |
| (interactive) | |
| (indent-region (point-min) (point-max))) | |
| (defun indent-region-or-buffer () | |
| (interactive) | |
| (if (use-region-p) (indent-region (region-beginning) (region-end)) | |
| (indent-buffer))) |
This file contains hidden or 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
| class Array | |
| def merge_sort(&block) | |
| return self if size < 2 | |
| block ||= lambda { |a, b| a <=> b } | |
| half_size = size / 2 | |
| first_ary = self[0, half_size].merge_sort(&block) | |
| second_ary = self[half_size, size].merge_sort(&block) |
This file contains hidden or 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 tmp-function (argument) | |
| (interactive (list (read-string "enter: " "default"))) | |
| (message "the argument was %s" argument)) |
This file contains hidden or 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
| class Module | |
| def around_module | |
| unless defined? @around_module | |
| prepend (@around_module = Module.new) | |
| end | |
| @around_module | |
| end | |
| def around(&block) |
This file contains hidden or 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
| 10 | |
| 10 30 | |
| 60 50 50 | |
| 10 | |
| 20 10 | |
| 10 10 80 |
This file contains hidden or 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
| class A | |
| Con = 42 | |
| class B | |
| A = 32 | |
| Con #=> 42 | |
| A #=> 32 | |
| A::Con #=> Error | |
| end |
This file contains hidden or 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
| ;; Won't be the file where I will put 99% percent of my config, this time. | |
| (setq-default fill-column 80) | |
| (fset 'yes-or-no-p 'y-or-n-p) | |
| (setq make-backup-files nil) | |
| (setq auto-save-default nil) | |
| (setq require-final-newline t) |