-
Notifications
You must be signed in to change notification settings - Fork 0
/
rubykaigi.el
310 lines (264 loc) · 8.46 KB
/
rubykaigi.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
;; These are the slides that will be run during the RubyKaigi
;; This is how I will record what I am doing to create a proper
;; script.
(progn
(open-dribble-file "/tmp/rubykaigi-dribble.el"))
;; Window register a
(progn
"Initial setup"
(menu-bar-mode 1)
(tool-bar-mode -1)
(modify-frame-parameters nil '(
(width . 138) (height . 45)
(top . 22)
(left . 7)))
(frame-configuration-to-register ?b) ;; Store original config
;; (message "Mac set to full screen frame config \n %s" (current-frame-configuration))
)
;; Frame configuration a and b are full screen modes with b being
;; normal font and a having the larger font
(progn
"animate"
;; Do I WANT THIS SIZE?
(set-face-attribute 'default nil :height 200)
(modify-frame-parameters nil '(
(width . 80) (height . 26)
(top . 22)
(left . 7)))
(frame-configuration-to-register ?a)
(delete-other-windows)
(sit-for 2)
(animate-sequence (list "M-x ruby-and-emacs-workshop" "RubyKaigi 2010" "Zev Blut" "& You" "2010-08-28") 1))
(democamp/load-presentation "intro.txt")
(progn
"curves"
;; http://blogs.msdn.com/b/steverowe/archive/2004/11/17/code-editor-learning-curves.aspx
(find-file (concat democamp/image-dir "curves.jpg")))
(progn
"poll"
(democamp/load-presentation "poll.txt"))
;; ruby-mode in action
;; epresent file 1
(progn
"presentation globbed together"
(democamp/load-presentation "ruby_and_inf.txt"))
(progn
"Ruby Koan"
(democamp/load-presentation "ruby_koan.txt"))
(progn
"Ruby extras"
(democamp/load-presentation "ruby_extras.txt"))
;; This was too fast and did not make sense
;; ;; kind of want a macro to show the key combination and the defun it
;; ;; is mapped to then run the combo and delay for a second
;; (progn
;; "Moving around ruby"
;; (delete-other-windows)
;; (jump-to-register ?b)
;; ;; (set-face-attribute 'default nil :height 200)
;; (democamp/load-code "cgi.rb")
;; ;; simple paragraph movement
;; (dcse 'forward-paragraph 5)
;; (dcse 'backward-paragraph 5)
;; ;; defun movement
;; (dcse 'ruby-end-of-defun 5)
;; (dcse 'ruby-beginning-of-defun 5)
;; ;; sexp movement
;; ;; may want to search to a def of inside an if
;; (dcse 'forward-paragraph 2)
;; (dcse 'forward-paragraph 2)
;; (dcse 'ruby-forward-sexp 4)
;; (dcse 'ruby-forward-sexp 2)
;; (dcse 'ruby-forward-sexp 2)
;; ;; block movement
;; (search-forward "initialize")
;; (dcse 'ruby-end-of-block 5)
;; (dcse 'ruby-end-of-block 2)
;; (dcse 'ruby-beginning-of-block 5)
;; )
;; Just remember to show off yari during the Koans
;; ;; Using ri
;; (progn
;; "using ri"
;; (delete-other-windows)
;; (jump-to-register ?b)
;; (set-face-attribute 'default nil :height 200)
;; (democamp/load-code "sample.rb")
;; (search-forward "inject")
;; (yari))
;; Not working well either
;; (progn
;; "Skip not working inf ruby mode"
;; (delete-other-windows)
;; (dcse 'inf-ruby 5)
;; (democamp/load-code "sample.rb")
;; (delete-other-windows)
;; (beginning-of-buffer)
;; (sit-for 1)
;; (search-forward "sum")
;; (sit-for 1)
;; (ruby-send-definition)
;; (split-window-vertically)
;; (switch-to-buffer "*ruby*")
;; (switch-to-buffer "sample.rb")
;; (end-of-buffer)
;; (insert "\n\nHoge.new.sum([5])")
;; ;; (move-beginning-of-line)
;; ;; (set-mark-command)
;; ;; (move-end-of-line)
;; (ruby-send-region-and-go)
;; )
;; from http://github.com/rust/dotemacs/blob/master/.emacs
(progn
"Testing out align"
(delete-other-windows)
(progn
(require 'align)
(add-to-list 'align-rules-list
'(ruby-comma-delimiter
(regexp . ",\\(\\s-*\\)[^# \t\n]")
(repeat . t)
(modes . '(ruby-mode))))
(add-to-list 'align-rules-list
'(ruby-hash-literal
(regexp . "\\(\\s-*\\)=>\\s-*[^# \t\n]")
(repeat . t)
(modes . '(ruby-mode))))
(add-to-list 'align-rules-list
'(ruby-assignment-literal
(regexp . "\\(\\s-*\\)=\\s-*[^# \t\n]")
(repeat . t)
(modes . '(ruby-mode))))
(add-to-list 'align-rules-list ;TODO add to rcodetools.el
'(ruby-xmpfilter-mark
(regexp . "\\(\\s-*\\)# => [^#\t\n]")
(repeat . nil)
(modes . '(ruby-mode))))
)
(democamp/load-code "align.rb")
;; (beginning-of-buffer)
;; (set-mark-command)
;; (end-of-buffer)
;; (dcse 'align 5)
)
;; after an epresent-mode the screen is wonky revert to frame config
;; (progn
;; ;; jumping back does not seem to work (super slow genie effect)
;; ;;(jump-to-register ?a)
;; (set-face-attribute 'default nil :height 200))
;; Rinari emacs-rails
(progn
"rails-mode"
(democamp/load-code "calculator/app/models/quiz.rb"))
(progn
"Ediff"
(democamp/load-presentation "diff.txt"))
(progn
"Go show the diff"
(ediff "/Users/Zev/other_code/ruby_trunk/misc/ruby-mode.el" "/Users/Zev/projects/emacs-starter-kit/elpa/ruby-mode-1.1/ruby-mode.el"))
(progn
"Shell mode features"
(delete-other-windows)
;;(jump-to-register ?a)
(ansi-term "/bin/zsh")
(insert "echo 'this is an example of scripting input inside an Emacs term'")
(term-send-input)
(insert (concat "cd " democamp/presentation-dir))
(completing-read "enter for next command." '())
(term-send-input)
(insert "cat basics.txt")
(term-send-input)
(insert "echo back to term-line-mode C-c j to work with shell like a standard buffer")
(term-send-input)
(insert "echo do a reverse search for basics")
;; (dcse 'term-line-mode 5)
;; (dcse 'isearch-backward nil '("@Basics"))
;; (dcse 'backward-sentence 3)
;; (dcse 'term-char-mode 5)
;; (insert "echo back to term-char-mode C-c k to show how it works like standard shell")
;; (term-send-input)
;; (insert "echo This is all very useful for things like passwords and what not")
;; (term-send-input)
)
(progn
"Using SQL inside of emacs"
(delete-other-windows)
(setq sql-sqlite-program "sqlite3")
(setq sql-database (concat democamp/code-dir "sample.db"))
(sql-sqlite)
(delete-other-windows)
(sit-for 2)
;;create db
(insert "create table memos(text, priority INTEGER);")
(comint-send-input)
(insert "insert into memos values('deliver project description', 10);")
(comint-send-input)
(insert "insert into memos values('lunch with Christine', 100);")
(comint-send-input)
(completing-read "enter for next command." '())
(insert "select * from memos;")
(comint-send-input)
(completing-read "enter for next command." '())
(insert "insert into memos values('show standard history with M-p', 20);")
(comint-send-input)
;; Show sql-send-region from other buffer
)
(progn
"vc slides"
(democamp/load-presentation "vc.txt"))
(progn
"Show off magit and git.el in vc-status"
(delete-other-windows)
;; more consisten with the cvs/svn/etc commands
(completing-read "enter for next command." '())
(dcse 'magit-status nil "")
;; git.el and vc-git are slightly different but vc-annotate now works!
;; (completing-read "enter for next command." '())
;; (dcse 'git-status nil "")
;; log and blame are strong here also integrats with vc tools so
)
(progn
"Show off occur"
(delete-other-windows)
(democamp/load-code "cgi.rb")
(completing-read "enter to run occur." '())
(dcse 'occur 5 "post")
)
(progn
"grep"
(delete-other-windows)
(rgrep "ruby")
)
(progn
"Tags"
;; Need to update etags for ruby and recursive directory search
)
(progn
"xkcd"
(delete-other-windows)
;; http://xkcd.com/378/
(find-file (concat democamp/image-dir "real_programmers.png")))
(progn
"learn more"
(democamp/load-presentation "learn_more.txt"))
(progn
"show and tell and animation"
(set-face-attribute 'default nil :height 200)
(modify-frame-parameters nil '(
(width . 80) (height . 26)
(top . 22)
(left . 7)))
(delete-other-windows)
(sit-for 1)
(animate-sequence (list "Show" "and" "Tell") 1))
(progn
"show and tell slides"
(democamp/load-presentation "show_and_tell.txt"))
(progn
"challenges"
(democamp/load-presentation "challenges.txt"))
(progn
"Presentation part of workshop is over"
(animate-sequence (list "C-x C-c" "Thank You!") 3)
(sit-for 1)
(zone))