Skip to content

Instantly share code, notes, and snippets.

View devinus's full-sized avatar

Devin Alexander Torres devinus

View GitHub Profile
@devinus
devinus / elixir.rb
Created September 10, 2012 19:21 — forked from josevalim/elixir.rb
Elixir Homebrew recipe
# Install this recipe with:
# brew install https://raw.github.com/gist/1968046/0302279edc972e9d147110bd69284d0e2becda41/elixir.rb
require 'formula'
class ErlangInstalled < Requirement
def message; <<-EOS.undent
Erlang is required to install.
You can install this with:
defmacro __w__({ :<<>>, _line, [string] }, []) when is_binary(string) do
Regex.split(%R/\s+/, Macro.unescape_binary(string), [parts: 0])
end
defmacro __w__({ :<<>>, line, pieces }, []) do
binary = { :<<>>, line, Macro.unescape_tokens(pieces) }
quote do: Regex.split(%R/\s+/, unquote(binary), [parts: 0])
end
defmacro __W__({ :<<>>, _line, [string] }, []) when is_binary(string) do
@devinus
devinus / elixir.rb
Created September 13, 2012 15:45 — forked from josevalim/elixir.rb
Elixir Homebrew recipe
# Install this recipe with:
# brew install --HEAD https://raw.github.com/gist/3715216/fcc8b4142a0010d04dc2bba6c2d7d641c137f615/elixir.rb
require 'formula'
class ErlangInstalled < Requirement
def message; <<-EOS.undent
Erlang is required to install.
You can install this with:
~ ❯ ab -k -n10 -c10 http://127.0.0.1:4000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient).....done
Server Software: Cowboy
Server Hostname: 127.0.0.1

Thoughts on Elixir

  1. Module attrs can't be defined after their use in the module? E.g.
defmodule Foo do
  def do_foo do
    Bar.query @foo_query
 end
@devinus
devinus / elixir.rb
Last active December 10, 2015 13:59
# Install this recipe with:
# brew install --HEAD https://gist.github.com/raw/4444473/8327862dbfd4191d6a407c4d877c6146d4f07ca3/elixir.rb
require 'formula'
class ErlangInstalled < Requirement
def message; <<-EOS.undent
Erlang is required to install.
You can install this with:
defmodule List.Dict do
def new do
[]
end
def new(pairs) when is_list(pairs) do
pairs
end
def new(pairs) do
defprotocol Dict.Protocol do
def keys(dict)
def values(dict)
def size(dict)
def has_key?(dict, key)
def get(dict, key, default)
def get!(dict, key)
def put(dict, key, val)
def put_new(dict, key, val)
def delete(dict, key)
Using unsupported plugin 'amqp'. This plugin isn't well supported by the community and likely has no maintainer. For more information about plugin statuses, see http://logstash.net/docs/1.1.7/plugin-status {:level=>:warn}
Deprecated config item "name" set in LogStash::Outputs::Amqp {:name=>"name", :plugin=>#<LogStash::Outputs::Amqp:0x4269ca43 @logger=#<LogStash::Logger:0x2f5e16c5 @target=#<IO:fd 1>, @subscriber_lock=#<Mutex:0x4a28f7ce>, @metrics=#<Cabin::Metrics:0x47a51b6b @channel=#<Cabin::Channel:0x28ab328c @subscriber_lock=#<Mutex:0x7f839a2f>, @data={}, @metrics=#<Cabin::Metrics:0x18ffc510 @channel=#<Cabin::Channel:0x28ab328c ...>, @metrics={}, @metrics_lock=#<Mutex:0x3fe2aa42>>, @subscribers={}, @level=:info>, @metrics={}, @metrics_lock=#<Mutex:0x3a17f3d2>>, @data={}, @subscribers={2056=>#<Cabin::Outputs::IO:0x16fa55f8 @lock=#<Mutex:0xd221891>, @io=#<IO:fd 1>>}, @level=:warn>, @params={"host"=>"127.0.0.1", "port"=>5672, "user"=>"guest", "password"=><password>, "exchange_type"=>"direct", "name"=>"elastics
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit