profile
viewpoint
Gustavo Saiani gusaiani Senior FE Engineer @getcircuit gustavosaiani.com blog.gustavosaiani.com

gusaiani/elixir-oh-my-zsh 125

Oh My Zsh plugin for Elixir, IEX, Mix and Phoenix

gusaiani/elixir_style_guide 34

Um guia de estilo feito pela comunidade para Elixir

gusaiani/colemak-home-row-frenzy 2

macOS keybindings for Colemak keyboard layout users

gusaiani/atom-snippets 1

Gustavo Saiani’s Atom Snippets

gusaiani/elm-tutorial 1

A study repo where I go through elm-tutorial

besirovic/toptal-calculator 0

Pocket calculator app build as interview technical test for Toptal

gusaiani/absinthe-book 0

Working on Craft GraphQL APIs in Elixir with Absinthe book

gusaiani/absinthe-book-frontend 0

A frontend built with Apollo and Next.js to render things from the Absinthe Elixir book

PR opened elixir-lang/elixir

Be specific about lists when they are proper lists

It was not clear to me when we use the notation [...] whether those were proper lists or may be improper lists as well.

+3 -3

0 comment

2 changed files

pr created time in an hour

issue closedelixir-lang/elixir

String.at edge case

Filing this issue after mentioning it at https://elixirforum.com/t/string-at-edge-case/35961

It has to do with String.at when the string is nil and position is 0.

Environment

Ubuntu 20.10 Erlang/OTP 23 [erts-11.0.3] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] Elixir 1.10.3 (compiled with Erlang/OTP 22)

Current behavior

String.at nil, 0
=> nil # Was expecting an error here, as in the next example:
String.at nil, 1
=> ** (FunctionClauseError) no function clause matching in String.Unicode.next_grapheme_size/1

I was surprised that nil was returned because all (most?) String functions will raise (some sort of) a FunctionClauseError when the input string is not a binary.

Expected behavior

I was expecting an error when passing nil as the first argument to String.at, no matter the position.

closed time in 3 hours

zwippie

issue commentelixir-lang/elixir

String.at edge case

Oh wait, I think this is fixed in a newer version of Elixir. This MR seems to fix it: https://github.com/elixir-lang/elixir/pull/10506/files

Sorry for the noise... :disappointed_relieved:

zwippie

comment created time in 3 hours

issue openedelixir-lang/elixir

String.at edge case

Filing this issue after mentioning it at https://elixirforum.com/t/string-at-edge-case/35961

It has to do with String.at when the string is nil and position is 0.

Environment

Ubuntu 20.10 Erlang/OTP 23 [erts-11.0.3] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] Elixir 1.10.3 (compiled with Erlang/OTP 22)

Current behavior

String.at nil, 0
=> nil # Was expecting an error here, as in the next example:
String.at nil, 1
=> ** (FunctionClauseError) no function clause matching in String.Unicode.next_grapheme_size/1

I was surprised that nil was returned because all (most?) String functions will raise (some sort of) a FunctionClauseError when the input string is not a binary.

Expected behavior

I was expecting an error when passing nil as the first argument to String.at, no matter the position.

created time in 3 hours

issue commentelixir-lang/elixir

1.11.2 tag update - Unable to load crypto library

Looks like that's a problem with Ubuntu Focal (20.04) libraries and Erlang dependencies. Ubuntu 18.04 supports both libssl1.0 and libssl1.1, but 20..04 only the second one. https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=libssl1.&searchon=names

Possibly related: actions/setup-elixir#31

Also please use Elixir Forum for asking questions.

michaelst

comment created time in 8 hours

issue closedelixir-lang/elixir

1.11.2 tag update - Unable to load crypto library

Environment

  • Elixir & Erlang/OTP versions (elixir --version): 1.11.2-otp-23
  • Operating system: Ubuntu (github actions)

It looks like the 1.11.2 tag was updated today and our builds started breaking pulling the new tag

2020-12-03T17:41:51.3689562Z [command]/home/runner/work/_temp/.setup-elixir/elixir/bin/mix local.rebar --force
2020-12-03T17:41:51.7996023Z 
2020-12-03T17:41:51.7997868Z 17:41:51.792 [error] Unable to load crypto library. Failed with error:
2020-12-03T17:41:51.8001230Z ":load_failed, Failed to load NIF library /home/runner/work/_temp/.setup-elixir/otp/lib/crypto-4.8/priv/lib/crypto: 'libcrypto.so.1.0.0: cannot open shared object file: No such file or directory'"
2020-12-03T17:41:51.8003766Z OpenSSL might not be installed on this system.
2020-12-03T17:41:51.8004666Z 
2020-12-03T17:41:51.8040904Z 
2020-12-03T17:41:51.8042696Z 17:41:51.800 [warn]  The on_load function for module crypto returned:
2020-12-03T17:41:51.8044385Z {:error,
2020-12-03T17:41:51.8045445Z  {:load_failed,
2020-12-03T17:41:51.8048006Z   'Failed to load NIF library /home/runner/work/_temp/.setup-elixir/otp/lib/crypto-4.8/priv/lib/crypto: \'libcrypto.so.1.0.0: cannot open shared object file: No such file or directory\''}}
2020-12-03T17:41:51.8049747Z 
2020-12-03T17:41:51.8087458Z ** (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:eoptions, {:undef, [{:crypto, :supports, [], []}, {:tls_record, :sufficient_support, 1, [file: 'tls_record.erl', line: 743]}, {:tls_record, :supported_protocol_versions, 1, [file: 'tls_record.erl', line: 370]}, {:tls_record, :supported_protocol_versions, 0, [file: 'tls_record.erl', line: 358]}, {:ssl, :handle_option, 4, [file: 'ssl.erl', line: 1920]}, {:ssl, :process_options, 3, [file: 'ssl.erl', line: 1644]}, {:ssl, :handle_options, 3, [file: 'ssl.erl', line: 1598]}, {:ssl, :connect, 4, [file: 'ssl.erl', line: 600]}]}}}]}
2020-12-03T17:41:51.8090752Z 
2020-12-03T17:41:51.8093250Z Could not install Rebar because Mix could not download metadata at https://repo.hex.pm/installs/rebar-1.x.csv.
2020-12-03T17:41:51.8094483Z 
2020-12-03T17:41:51.8128343Z ##[error]The process '/home/runner/work/_temp/.setup-elixir/elixir/bin/mix' failed with exit code 1

closed time in 10 hours

michaelst

issue commentelixir-lang/elixir

1.11.2 tag update - Unable to load crypto library

Hi @michaelst, this is not an Elixir issue. There is either something wrong or corrupted in your Erlang installation/checkout. You can try doing running crypto:version() and crypto:supports() in an Erlang shell and it will most likely fail too, so I recommend investigating there. :)

michaelst

comment created time in 10 hours

issue openedelixir-lang/elixir

1.11.2 tag update - Unable to load crypto library

Environment

  • Elixir & Erlang/OTP versions (elixir --version): 1.11.2-otp-23
  • Operating system: Ubuntu (github actions)

It looks like the 1.11.2 tag was updated today and our builds started breaking pulling the new tag

2020-12-03T17:41:51.3689562Z [command]/home/runner/work/_temp/.setup-elixir/elixir/bin/mix local.rebar --force
2020-12-03T17:41:51.7996023Z 
2020-12-03T17:41:51.7997868Z 17:41:51.792 [error] Unable to load crypto library. Failed with error:
2020-12-03T17:41:51.8001230Z ":load_failed, Failed to load NIF library /home/runner/work/_temp/.setup-elixir/otp/lib/crypto-4.8/priv/lib/crypto: 'libcrypto.so.1.0.0: cannot open shared object file: No such file or directory'"
2020-12-03T17:41:51.8003766Z OpenSSL might not be installed on this system.
2020-12-03T17:41:51.8004666Z 
2020-12-03T17:41:51.8040904Z 
2020-12-03T17:41:51.8042696Z 17:41:51.800 [warn]  The on_load function for module crypto returned:
2020-12-03T17:41:51.8044385Z {:error,
2020-12-03T17:41:51.8045445Z  {:load_failed,
2020-12-03T17:41:51.8048006Z   'Failed to load NIF library /home/runner/work/_temp/.setup-elixir/otp/lib/crypto-4.8/priv/lib/crypto: \'libcrypto.so.1.0.0: cannot open shared object file: No such file or directory\''}}
2020-12-03T17:41:51.8049747Z 
2020-12-03T17:41:51.8087458Z ** (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:eoptions, {:undef, [{:crypto, :supports, [], []}, {:tls_record, :sufficient_support, 1, [file: 'tls_record.erl', line: 743]}, {:tls_record, :supported_protocol_versions, 1, [file: 'tls_record.erl', line: 370]}, {:tls_record, :supported_protocol_versions, 0, [file: 'tls_record.erl', line: 358]}, {:ssl, :handle_option, 4, [file: 'ssl.erl', line: 1920]}, {:ssl, :process_options, 3, [file: 'ssl.erl', line: 1644]}, {:ssl, :handle_options, 3, [file: 'ssl.erl', line: 1598]}, {:ssl, :connect, 4, [file: 'ssl.erl', line: 600]}]}}}]}
2020-12-03T17:41:51.8090752Z 
2020-12-03T17:41:51.8093250Z Could not install Rebar because Mix could not download metadata at https://repo.hex.pm/installs/rebar-1.x.csv.
2020-12-03T17:41:51.8094483Z 
2020-12-03T17:41:51.8128343Z ##[error]The process '/home/runner/work/_temp/.setup-elixir/elixir/bin/mix' failed with exit code 1

created time in 10 hours

push eventlostpebble/pullstate

Paul Myburgh

commit sha e639d3e9d75c8fbea073ced09d9cd000c0845f7e

Adding in the ability to set a custom context on the pullstate instance, for flexible SSR scenarios

view details

push time in 12 hours

PR closed trekhleb/javascript-algorithms

Created parity algorithm

I have decided to add an algorithm for finding the parity of a number because I feel like such an algorithm should be added to this repository.

+48 -0

4 comments

4 changed files

mrwolferinc

pr closed time in 13 hours

pull request commenttrekhleb/javascript-algorithms

Created parity algorithm

This is a terrible practice. To determine parity, use x % 2 for everyday code or x & 1 if you really wanna go low-level uber-performance. Also your definition of parity for fractions is ridiculous. Where did you find it?

Oh ok

mrwolferinc

comment created time in 13 hours

PR closed trekhleb/javascript-algorithms

Update Branch & Bound description in README.md
  • Changes 'a lower' (bound) to 'an upper' (bound) to reflect presumed meaning.
+0 -0

1 comment

0 changed file

knight7

pr closed time in 14 hours

push eventelixir-lang/elixir

José Valim

commit sha 1b13706fefe2caec9093c84ca01164756617a373

Verify arith error on bad inputs

view details

push time in 15 hours

pull request commentelixir-lang/elixir

Add Integer.pow/2 and Float.pow/2

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

josevalim

comment created time in 16 hours

push eventelixir-lang/elixir

José Valim

commit sha 51f7c838686da1686b56edb1b5a4a287e0353ee6

Add Integer.pow/2 and Float.pow/2 (#10528)

view details

push time in 16 hours

delete branch elixir-lang/elixir

delete branch : jv-pow

delete time in 16 hours

PR merged elixir-lang/elixir

Add Integer.pow/2 and Float.pow/2
+82 -0

0 comment

2 changed files

josevalim

pr closed time in 16 hours

push eventelixir-lang/elixir

José Valim

commit sha f8b9ed69bb709a2ffc1e72b2ad4c9a3ee2cf1bda

Apply suggestions from code review Co-authored-by: Fernando Tapia Rico <fertapric@gmail.com>

view details

push time in 16 hours

Pull request review commentelixir-lang/elixir

Add Integer.pow/2 and Float.pow/2

 defmodule Integer do   """   defguard is_even(integer) when is_integer(integer) and (integer &&& 1) == 0 +  @doc """+  Computes `base` raised to power of `exponent`.++  Both `base` and `exponent` must be integers.+  The exponent must be zero or positive.++  See `Float.pow/2` for exponentiation of negative+  exponents as well as floats.++  ## Examples++      iex> Integer.pow(2, 0)+      1+      iex> Integer.pow(2, 1)+      2+      iex> Integer.pow(2, 10)+      1024+      iex> Integer.pow(2, 11)+      2048+      iex> Integer.pow(2, 64)+      0x10000000000000000++      iex> Integer.pow(3, 4)+      81+      iex> Integer.pow(4, 3)+      64++      iex> Integer.pow(-2, 3)+      -8+      iex> Integer.pow(-2, 4)+      16++  """+  def pow(base, exponent) when is_integer(base) and is_integer(exponent) and exponent >= 0 do
  """
  @doc since: "1.12.0"
  @spec pow(integer, pos_integer) :: integer
  def pow(base, exponent) when is_integer(base) and is_integer(exponent) and exponent >= 0 do
josevalim

comment created time in 16 hours

Pull request review commentelixir-lang/elixir

Add Integer.pow/2 and Float.pow/2

 defmodule Float do   @precision_range 0..15   @type precision_range :: 0..15 +  @doc """+  Computes `base` raised to power of `exponent`.++  `base` must be a float and `exponent` can be any number.+  However, if a negative base and a fractional exponent+  are given, it raises `ArithmeticError`.++  It always returns a float. See `Integer.pow/2` for+  exponentiation that returns integers.++  ## Examples++      iex> Float.pow(2.0, 0)+      1.0+      iex> Float.pow(2.0, 1)+      2.0+      iex> Float.pow(2.0, 10)+      1024.0+      iex> Float.pow(2.0, -1)+      0.5+      iex> Float.pow(2.0, -3)+      0.125++      iex> Float.pow(3.0, 1.5)+      5.196152422706632++      iex> Float.pow(-2.0, 3)+      -8.0+      iex> Float.pow(-2.0, 4)+      16.0++  """+  def pow(base, exponent) when is_float(base) and is_number(exponent),
  """
  @doc since: "1.12.0"
  @spec pow(float, number) :: float
  def pow(base, exponent) when is_float(base) and is_number(exponent),
josevalim

comment created time in 16 hours

push eventelixir-lang/elixir

José Valim

commit sha 8c82f4599d47a5fcd52d6cc602713849140db258

Moar floats

view details

push time in 17 hours

push eventelixir-lang/elixir

José Valim

commit sha 30e1925c08fc0e17bed2c296a013d105fb9be66b

Update lib/elixir/lib/float.ex

view details

push time in 17 hours

Pull request review commentelixir-lang/elixir

Add Integer.pow/2 and Float.pow/2

 defmodule Float do   @precision_range 0..15   @type precision_range :: 0..15 +  @doc """+  Computes `base` raised to power of `exponent`.++  `base` must be a float and `exponent` can be any number.+  However, if a negative base and a fractional exponent+  are given, it raises argument error.
  are given, it raises `ArithmeticError`.
josevalim

comment created time in 17 hours

push eventelixir-lang/elixir

José Valim

commit sha 7761a69fec4c57b179b2ae95d79a9ed12d779260

Fix type

view details

push time in 17 hours

Pull request review commentelixir-lang/elixir

Add Integer.pow/2 and Float.pow/2

 defmodule Float do   @precision_range 0..15   @type precision_range :: 0..15 +  @doc """+  Computes `base` raised to power of `exponent`.++  `base` must be a float and `exponent` can be any number.+  However, if a negative base and a fractional exponent+  are given, it raises argument error.

Do we use "argument error" to refer all argument errors? Or only ArgumentError? I found it is captured as ArithmeticError in Elixir 1.1.2 / OTP 23.1.2

defmodule Foo do
  def pow(base, exponent) when is_float(base) and is_number(exponent),
    do: :math.pow(base, exponent)
end

Foo.pow(-1.0, 1.1)
** (ArithmeticError) bad argument in arithmetic expression
    (stdlib 3.13.2) :math.pow(-1.0, 1.1)
    iex:3: Foo.pow/2
josevalim

comment created time in 17 hours

PR opened elixir-lang/elixir

Add Integer.pow/2 and Float.pow/2
+78 -0

0 comment

2 changed files

pr created time in 17 hours

create barnchelixir-lang/elixir

branch : jv-pow

created branch time in 17 hours

issue commentelixir-lang/elixir

Compiler hang

This should be fixed on Erlang 22.3.4.1 released today. A fix for 23.0 is coming out soon. Thanks everyone for helping!

We switched to Erlang 22.3.4.1. We still observe Erlang compiler hangs about 5-10% of our runs in CI - we have almost 800K of Erlang in our project spread over 8 files. (ASN.1 codecs generated by asn1ct.) It seems that the compiler hangs until the job is killed about 40 minutes later.

dmorneau

comment created time in 19 hours

pull request commenttrekhleb/javascript-algorithms

Repeated Math operation

Codecov Report

Merging #584 (fc731b9) into master (2c74ced) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #584   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          150       150           
  Lines         2627      2627           
  Branches       437       437           
=========================================
  Hits          2627      2627           
Impacted Files Coverage Δ
...thms/uncategorized/rain-terraces/bfRainTerraces.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2c74ced...fc731b9. Read the comment docs.

vladimirschneider

comment created time in a day

more