This file contains hidden or 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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
appName: 'SISPREV COMPONENT' | |
}); |
This file contains hidden or 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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
username: postgres | |
password: pass123 | |
host: localhost | |
port: 5432 | |
development: |
This file contains hidden or 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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
username: postgres | |
password: pass123 | |
host: localhost | |
port: 5432 | |
development: |
This file contains hidden or 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
# elixir | |
ages = [10, 18, 25] | |
def calc(x) do | |
# reuse x for some reason | |
List.delete(x, 10) | |
end | |
calc(ages) | |
ages |
This file contains hidden or 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
case File.read("my_file.ex") do | |
{:ok, contents} -> | |
case Code.eval_string(contents) do | |
{res, _binding} -> | |
{:ok, res} | |
error -> | |
error | |
error -> error | |
error | |
end |
This file contains hidden or 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
# Find customer, get all his orders, calc 5% tax | |
# Multiple line | |
customer = DB.find_customer(20) | |
orders = DB.find_orders_of_customer(customer) | |
taxed_orders = tax_orders(orders, 5) | |
# One line | |
tax_orders(DB.find_orders_of_customer(DB.find_customer(20)), 5) |
This file contains hidden or 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> x = 1 | |
1 | |
iex> 1 = x | |
1 | |
iex> 2 = x | |
** (MatchError) no match of right hand side value: 1 |
This file contains hidden or 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
# function that blocks for 2 seconds and return the param | |
slow_calc = fn(input) -> | |
:timer.sleep(2000) | |
input | |
end | |
1..5 |> Enum.map(&slow_calc.(&1)) # call slow_calc from 1 to 5 | |
#> [1, 2, 3, 4, 5] # takes 10 seconds to return (2 secs each) | |
# parellelize slow_calc |
This file contains hidden or 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
Lotus::Model.migration do | |
up do | |
create_table :my_table do | |
column :code, :integer, null: false | |
end | |
execute %Q(COMMENT ON TABLE my_table IS 'You should do it') | |
execute %Q(COMMENT ON COLUMN my_table.code IS 'Easy and useful') | |
end | |
end |
This file contains hidden or 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
Lotus::Model.migration do | |
up do | |
create_table :my_table do | |
column :code, :integer, null: false | |
index :code | |
end | |
end | |
end |