Skip to content

Instantly share code, notes, and snippets.

View tonini's full-sized avatar
💭
I may be slow to respond.

Samuel Tonini tonini

💭
I may be slow to respond.
View GitHub Profile
(defun my-elixir-do-end-close-action (id action context)
(when (eq action 'insert)
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode)))
(sp-with-modes '(elixir-mode)
(sp-local-pair "->" "end"
:when '(("RET"))
:post-handlers '(:add my-elixir-do-end-close-action)
(defun alchemist-project-find-lib ()
(interactive)
(alchemist-project-find-dir "lib"))
(defun alchemist-project-find-web ()
(interactive)
(alchemist-project-find-dir "web"))
(defun alchemist-project-find-views ()
(interactive)
;; Atoms and singleton-like words like true/false/nil.
(,(elixir-rx (group (or atoms "true" "false" "nil"))
(zero-or-more space)
(optional "="))
1 elixir-atom-face)

Alchemist-Server API Refactoring

  • Cases
    • COMP (Completion)
    • DOCL (Documentation Lookup)
    • EVAL (Evaluate/Quote)
    • DEFL (Definition Lookup)
  • Alchemist-Server API
    • COMP
;; Display alchemist buffers always at the right side
;; Just change (side . right) with the position you would like 'bottom, 'top, 'right or 'left
;; Source: http://www.lunaryorn.com/2015/04/29/the-power-of-display-buffer-alist.html
(add-to-list 'display-buffer-alist
`(,(rx bos (or "*alchemist test report*"
"*alchemist mix*"
"*alchemist help*"))
(display-buffer-reuse-window
display-buffer-in-side-window)
(defun say-hello-when-keyboard-quit ()
(if (eq last-command 'keyboard-quit)
(message "YOU PRESSED C-g!")
(message "NOPE")))
(run-with-idle-timer 0.05
0.05
'say-hello-when-keyboard-quit)
List.flatten(
[12,3,4,5,[2,3,4]],
"[2,4]"
)
# {{:., [line: 1], [{:__aliases__, [counter: 0, line: 1], [:List]}, :flatten]},
# [line: 1], [[12, 3, 4, 5, [2, 3, 4]], "[2,4]"]}
@tonini
tonini / jezzz.ex
Last active August 29, 2015 14:26
case parse do
{ [ help: true ], _, _ }
-> :help
{ _, [ user, project, count ], _ } ->
{ user, project, count }
{ _, [ user, project ], _ } -> { user, project, @default_count }
_ -> :help
end
case parse do
(add-to-list 'display-buffer-alist
`(,(rx bos "*helm" (* not-newline) "*" eos)
(display-buffer-in-side-window)
(inhibit-same-window . t)
(window-height . 0.3)))
defmodule Summary do
def val do
a = 12
end
end