Comments? sacha@sachachua.com
- Emacs learning curve?
- Mix of Emacs geeks skewed towards people who’ve been using this for a while (after all, takes a certain commitment to come all the way to an Emacs conference!)
Comments? sacha@sachachua.com
| (require 's) | |
| (defun rlb3/toggle-file () | |
| (interactive) | |
| (let* ((full-path (buffer-file-name)) | |
| (path (rlb3/remove-ulc full-path)) | |
| (file-type (rlb3/determine-file-type path))) | |
| (if (eq file-type 'test) | |
| (rlb3/jump-to-related-test path) | |
| (rlb3/jump-to-related-module path)))) |
| (eval-when-compile (require 'cl)) | |
| (require 'json) | |
| (require 'url) | |
| (require 'url-http) | |
| (defgroup cpanel nil | |
| "cPanel customization group" | |
| :group 'cpanel | |
| :prefix "cpanel-") |
| (require 'multiple-cursors) | |
| (global-set-key (kbd "C-c C-e") 'mc/edit-lines) | |
| (global-set-key (kbd "C-c C-f") 'mc/mark-next-like-this) | |
| (global-set-key (kbd "C-c C-b") 'mc/mark-previous-like-this) | |
| (global-set-key (kbd "C-c C-x f") 'mc/mark-all-like-this) |
| (require 's) | |
| (defun rlb3/toggle-related-file () | |
| (interactive) | |
| (let* ((full-path (buffer-file-name)) | |
| (path (rlb3/remove-ulc full-path)) | |
| (file-type (rlb3/determine-file-type path))) | |
| (if (eq file-type 'test) | |
| (rlb3/jump-to-related-module path) | |
| (rlb3/jump-to-related-test path)))) |
| (defun show-frame (&optional frame) | |
| (raise-frame) | |
| (select-frame-set-input-focus (selected-frame)) | |
| (select-frame-set-input-focus (selected-frame))) |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| my $pid = $ARGV[0]; | |
| my $file = '/tmp/logfile.log'; | |
| open my $fh, '<', $file; | |
| while (pid_exists()){ |
| (require 's) | |
| (defun rlb3/toggle-file () | |
| (interactive) | |
| (let* ((full-path (buffer-file-name)) | |
| (path (rlb3/remove-ulc full-path)) | |
| (file-type (rlb3/determine-file-type path))) | |
| (if (eq file-type 'test) | |
| (rlb3/jump-to-related-test path) | |
| (rlb3/jump-to-related-module path)))) |
| #!/usr/bin/env ruby | |
| class MyObject | |
| def initialize | |
| ObjectSpace.define_finalizer(self, proc { destroy }) | |
| end | |
| def start | |
| puts 'start' | |
| end |
Jim Weirich:
This is how I explain it… Ruby has Procs and Lambdas. Procs are created with
Proc.new { }, lambdas are created withlambda {}and->() {}.
In Ruby 1.8,
proc {}creates lambda, and Ruby 1.9 it creates procs (don't ask).
Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.
This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.