Skip to content

Instantly share code, notes, and snippets.

View nicholasf's full-sized avatar

Nicholas Faiz nicholasf

View GitHub Profile
describe "ServiceFee", ->
before (done) ->
helper.getCleanDB (err, @db) =>
samples.agency.default @db, (err, @agency) => done()
# in the helper
getCleanDB: (cb) ->
models((err, db) -> db.driver.execQuery("TRUNCATE TABLE " + TABLE_RESET_ORDER.join(", ") + ";", ->
throw err if err
iex(16)> hd = HashDict.new([])
#HashDict<[]>
iex(17)> Dict.put hd, :foo, "hello"
#HashDict<[foo: "hello"]>
iex(18)> Dict.get hd, :foo
nil
iex(19)> hd[:foo]
nil
♪ spoonbot git:(master) ✗ mix compile
** (ArgumentError) argument error
(stdlib) re.erl:169: :re.split("deps.loadpaths", {:re_pattern, 0, 1, <<69, 82, 67, 80, 57, 0, 0, 0, 0, 8, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 0, ...>>}, [return: :binary, parts: :infinity])
(elixir) lib/regex.ex:294: Regex.split/3
(mix) lib/mix/utils.ex:300: Mix.Utils.command_to_module_name/1
(mix) lib/mix/utils.ex:61: Mix.Utils.command_to_module/2
(mix) lib/mix/task.ex:140: Mix.Task.get!/1
(mix) lib/mix/task.ex:168: Mix.Task.run/2
(mix) lib/mix/cli.ex:53: Mix.CLI.run_task/2
♪ spoonbot git:(master) ✗ mix compile
** (ArgumentError) argument error
(stdlib) re.erl:169: :re.split("deps.loadpaths", {:re_pattern, 0, 1, <<69, 82, 67, 80, 57, 0, 0, 0, 0, 8, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 0, ...>>}, [return: :binary, parts: :infinity])
(elixir) lib/regex.ex:308: Regex.split/3
(mix) lib/mix/utils.ex:310: Mix.Utils.command_to_module_name/1
(mix) lib/mix/utils.ex:61: Mix.Utils.command_to_module/2
(mix) lib/mix/task.ex:140: Mix.Task.get!/1
(mix) lib/mix/task.ex:168: Mix.Task.run/2
(mix) lib/mix/cli.ex:53: Mix.CLI.run_task/2
Interactive Elixir (0.12.5-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> str = "wows"
"wows"
iex(2)> pattern = ~r/#{:str}/
~r"str"
iex(3)> pattern2 = ~r/str/
~r"str"
iex(4)>
data without a HTML error event supporting stacktraces:
{"name":"CBT","hostname":"dawntreader.local","pid":81904,"level":50,"origin":"browser","line":"34832","url":"http://localhost:3000/app.4az9puqz9pncvk8qdu5ddvx2j4.js","msg":"Uncaught Error: test","time":"2014-02-25T04:37:18.415Z","v":0}
data with a HTML 5 error supporting stacktraces:
{"name":"CBT","hostname":"dawntreader.local","pid":82474,"level":30,"early":"\u001b[97mPOST /logging\u001b[39m \n{ msg: \u001b[32m'Uncaught Error: test'\u001b[39m,\n url: \u001b[32m'http://localhost:3000/app.2mkxky2w4q7vhv5rj7t26npkkm.js'\u001b[39m,\n line: \u001b[32m'34832'\u001b[39m,\n err: \u001b[32m'Error: test\\n at TripsPage.onActivate (http://localhost:3000/app.2mkxky2w4q7vhv5rj7t26npkkm.js:34832:11)\\n at TripsPage.Events.trigger (http://localhost:3000/app.2mkxky2w4q7vhv5rj7t26npkkm.js:12590:22)\\n at TripsPage.Spine.Controller.include.active (http://localhost:3000/app.2mkxky2w4q7vhv5rj7t26npkkm.js:12215:22)\\n at MainApp.callback (http://localhos
getCleanDB: (cb) ->
models((err, db) -> db.driver.execQuery("TRUNCATE TABLE " + TABLE_RESET_ORDER.join(", ") + ";", ->
if err
console.log JSON.stringify(err)
throw err
cb(null, db)))
TABLE_RESET_ORDER = [
"\"reservation\""
"\"trip_travellers\""
filter{
drop {
remove_tag => [ "v" ]
remove_field => [ "v" ]
}
json{
source => "message"
}
filter {
if [type] == "cbt" {
mutate {
remove_field => [ "v" ]
remove_field => [ "early" ]
remove_field => [ "offset" ]
remove_field => [ "host" ]
remove_field => [ "file" ]
}
if [log_level] in ["ERROR", "FATAL"] {
email {
to => "******"
from => "notifier@****"
subject => "%{log_level}: %{msg}."
if [error] {
body => "Time: \n%{time} \n\nMsg: \n%{msg} \n\nError: \n%{error}"
} else {
body => "Time: \n%{time} \n\nMsg: \n%{msg} \n\n This log message was missing an error object, it could be improved."
}