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 test (desc &rest body) | |
(declare (indent 1) (debug t)) | |
(list 'if desc (cons 'progn body))) | |
(test "some shiny stuff" | |
(print "hello") | |
(print "bye")) |
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 'ansi-color) | |
(defun ansi-colorize-current-buffer () | |
"Colorize ansi escape sequences in the current buffer." | |
(interactive) | |
(ansi-color-apply-on-region (point-min) (point-max))) |
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
(emms-play-file "~/heroes/zelda.mp3") |
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
sum = fn | |
[1,2,3] -> 1 + 2 + 3 | |
[] -> "Empty" | |
end | |
sum = function do | |
[1,2,3] -> 1 + 2 + 3 | |
[] -> "Empty" | |
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
From the Elixir language *master* documentation. | |
Function retrieval | |
The function macro can also be used to retrieve local, imported and remote functions. | |
square = fn(x) -> x * x end | |
Enum.map [1,2,3], function(square/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
$ rebar --version | |
rebar 2.1.0-pre R15B03 20130620_050022 No VCS info available. | |
$ which rebar | |
/usr/local/bin/rebar | |
$ mix deps.compile cowboy | |
* Compiling cowboy | |
==> cowboy (compile) | |
Dependency not available: ranch-.* ({git,"git://github.com/extend/ranch.git", |
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
iex(1)> Mix.start | |
:ok | |
iex(2)> Mix.Rebar.global_rebar_cmd | |
"/usr/local/bin/rebar" | |
iex(3)> Mix.Rebar.local_rebar_cmd | |
"/Users/tonini/.mix/rebar" | |
iex(4)> Mix.Rebar.rebar_cmd | |
"/usr/local/bin/rebar" | |
iex(5)> |
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
iex(1)> Code.eval_string("sam = fn name -> IO.puts \"Hello #{name}\" end") | |
** (UndefinedFunctionError) undefined function: IEx.Helpers.name/0 | |
IEx.Helpers.name() | |
erl_eval.erl:569: :erl_eval.do_apply/6 | |
erl_eval.erl:738: :erl_eval.expr_list/6 | |
erl_eval.erl:330: :erl_eval.expr/5 | |
eval_bits.erl:80: :eval_bits.eval_field/3 | |
eval_bits.erl:64: :eval_bits.expr_grp/4 | |
erl_eval.erl:400: :erl_eval.expr/5 | |
erl_eval.erl:738: :erl_eval.expr_list/6 |
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
import 'Items' do | |
from 'items' do |sequel| | |
sequel[<<-SQL | |
SELECT * | |
FROM tblItems | |
INNER JOIN tblOrderItems ON tblOrderItems.sItemID = tblItems.sID | |
SQL | |
] | |
sequel[:tblItems].join(:tblOrderItems, :sItemID => :sID) | |
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
import 'Items' do | |
from 'items' do |sequel| | |
sequel[<<-SQL | |
SELECT tblItems.point as hello | |
FROM tblItems | |
INNER JOIN tblOrderItems ON tblOrderItems.sItemID = tblItems.sID | |
SQL | |
] | |
end | |
to 'items' |