profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/gusaiani/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Gustavo Saiani gusaiani Senior FE Engineer @getcircuit gustavosaiani.com blog.gustavosaiani.com

gusaiani/elixir-oh-my-zsh 131

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

gusaiani/elixir_style_guide 37

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

pull request commentelixir-lang/elixir

raise FunctionClauseError when passing invalid arguments to Date.compare/2

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

tverlaan

comment created time in 7 hours

push eventelixir-lang/elixir

Timmo Verlaan

commit sha abbb7983a036947a1f2b15fe51fabd0f1854c51f

Raise FunctionClauseError when passing invalid arguments to Date.compare/2 (#10774)

view details

push time in 7 hours

PR merged elixir-lang/elixir

raise FunctionClauseError when passing invalid arguments to Date.compare/2

I accidentally passed a nil value to Date.compare/2 and got an UndefinedFunctionError:

iex(41)> Date.compare Date.utc_today, nil
** (UndefinedFunctionError) function nil.calendar/0 is undefined. If you are using the dot syntax, such as map.field or module.function(), make sure the left side of the dot is an atom or a map
    nil.calendar()
    (elixir 1.11.1) lib/calendar/date.ex:504: Date.compare/2

I think a FunctionClauseError would be more appropriate (and helpful) as it would provide a nice hint about what went wrong, similar to convert:

iex(1)> Date.convert nil, Date.utc_today()
** (FunctionClauseError) no function clause matching in Date.convert/2    
    
    The following arguments were given to Date.convert/2:
    
        # 1
        nil
    
        # 2
        ~D[2021-03-08]
    
    Attempted function clauses (showing 2 out of 2):
    
        def convert(%{calendar: calendar, year: year, month: month, day: day}, calendar)
        def convert(%{calendar: calendar} = date, target_calendar)
    
    (elixir 1.11.1) lib/calendar/date.ex:541: Date.convert/2

Hope this helps.

+2 -2

0 comment

1 changed file

tverlaan

pr closed time in 7 hours

pull request commentelixir-lang/elixir

Add Enum.find!

I agree with @ericmj that this is not in line with our current stdlib. Since there's a discussion developing here, I think we should close this PR and move the discussion to the elixir-lang-core mailing list as per our conventions (issue tracker for bugs, mailing list for feature proposals). :)

TheFirstAvenger

comment created time in 8 hours

PR opened elixir-lang/elixir

raise FunctionClauseError when passing invalid arguments to Date.compare/2

I accidentally passed a nil value to Date.compare/2 and got an UndefinedFunctionError:

iex(41)> Date.compare Date.utc_today, nil
** (UndefinedFunctionError) function nil.calendar/0 is undefined. If you are using the dot syntax, such as map.field or module.function(), make sure the left side of the dot is an atom or a map
    nil.calendar()
    (elixir 1.11.1) lib/calendar/date.ex:504: Date.compare/2

I think a FunctionClauseError would be more appropriate (and helpful) as it would provide a nice hint about what went wrong, similar to convert:

iex(1)> Date.convert nil, Date.utc_today()
** (FunctionClauseError) no function clause matching in Date.convert/2    
    
    The following arguments were given to Date.convert/2:
    
        # 1
        nil
    
        # 2
        ~D[2021-03-08]
    
    Attempted function clauses (showing 2 out of 2):
    
        def convert(%{calendar: calendar, year: year, month: month, day: day}, calendar)
        def convert(%{calendar: calendar} = date, target_calendar)
    
    (elixir 1.11.1) lib/calendar/date.ex:541: Date.convert/2

Hope this helps.

+2 -2

0 comment

1 changed file

pr created time in 9 hours

startedgusaiani/elixir_style_guide

started time in 11 hours

push eventelixir-lang/elixir

José Valim

commit sha 7795cfc48d37a84d1e235708f24509a9e99d2fb1

Fix bootstrap

view details

push time in 16 hours

push eventelixir-lang/elixir

José Valim

commit sha a4ddf18871d15828a8c1f1532658b45cfd3eb32e

Do not add compile time dependencies on @compile {:no_warn_undefined, _}

view details

push time in 16 hours

issue closedtrekhleb/javascript-algorithms

Jane doe swe12

Sweden

closed time in a day

Janedoeswe

issue closedtrekhleb/javascript-algorithms

Rich

closed time in a day

Janedoeswe

push eventelixir-lang/elixir

José Valim

commit sha 5b3ae1b8c302046992714a8da512f952557c304e

Rewrite not (foo in bar) to foo not in bar

view details

José Valim

commit sha 01fdb4c7fb3ec84d653660bf236dc7d6126bb113

Clarify compile-time dependencies on module attributes

view details

push time in a day

issue closedlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

This is the error I get after npm install pullstate in a create-react-app project

    code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR! 
    npm ERR! While resolving: my-app@0.1.0
    npm ERR! Found: react@17.0.1
    npm ERR! node_modules/react
    npm ERR!   react@"^17.0.1" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer react@"^16.12.0" from pullstate@1.20.1
    npm ERR! node_modules/pullstate
    npm ERR!   pullstate@"1.20.1" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Link to a related Stackoverflow question

closed time in a day

pSnehanshu

issue commentlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

You can check out version 1.21.0 now @pSnehanshu . I think it should fix this issue.

pSnehanshu

comment created time in a day

release lostpebble/pullstate

1.21.0

released time in a day

created taglostpebble/pullstate

tag1.21.0

Simple state stores using immer and React hooks - re-use parts of your state by pulling it anywhere you like!

created time in a day

push eventlostpebble/pullstate

Paul Myburgh

commit sha 8bf8209109a433a4052cb9ca8baf829ca1ea12a2

Added in cacheBroke flag for response from getCachedResult

view details

Paul Myburgh

commit sha 99c9af328f7b0b8c228e951b68f93cb8c555a9e3

Added in custom cacheBreakHook passing to async actions in UI

view details

Paul Myburgh

commit sha da3356dc6ea9d4eeb2ac1baf8353f85145ec6d48

Allowing passing of function as an initializer to Store

view details

Paul Myburgh

commit sha cf34e143ebeb0ec17bbf4b12e4667fe63a7261fa

Make sure cache breaking doesn't occur during a render on the server

view details

Paul Myburgh

commit sha 40ab6247519dcd2ca328cfe43cabba967681a578

Added in batch(), allowing batched state updates across multiple actions and stores

view details

Paul Myburgh

commit sha c6a61158506aa57ab13277ea861c67af38a9ce32

Allow passing of "false" to the custom CacheBreak hook

view details

Paul Myburgh

commit sha edd5f8a48813879afc368ae72a9703083252a3ed

Updating peer deps to support React 17, and releasing 1.21.0

view details

push time in a day

push eventlostpebble/pullstate

Paul Myburgh

commit sha edd5f8a48813879afc368ae72a9703083252a3ed

Updating peer deps to support React 17, and releasing 1.21.0

view details

push time in a day

issue commentelixir-lang/elixir

Warning when aliasing does not do anything

I can see why we could but I don’t see why we should, especially because this can be an issue for meta-programming as now people will have to check those cases to avoid warnings. So given there is no ambiguity or undefined behavior from it, I think we should not warn unless there is evidence otherwise. Thanks!

eksperimental

comment created time in 2 days

issue closedelixir-lang/elixir

Warning when aliasing does not do anything

iex(1)> alias Version
Version

Shouldn't we warn?

closed time in 2 days

eksperimental

issue commentlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

Because React is a peer dependency of Pullstate, is it not important to define that? I think for now, its better to have it than not- as it does provide information to tooling and also just for people who use various web apps to tell them about a libraries and what is required / size considerations. React is required for Pullstate to work, so its good to have it there.

pSnehanshu

comment created time in 2 days

issue openedelixir-lang/elixir

Warning when aliasing does not do anything

iex(1)> alias Version
Version

Shouldn't we warn?

created time in 2 days

issue commentlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

Why define preer dependancy at all?

pSnehanshu

comment created time in 2 days

issue commentlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

Actually - I may have been mistaken.

I might be able to solve this with the following:

"peerDependencies": {
    "react": "^16.12.0 || ^17.0.0"
  }
pSnehanshu

comment created time in 2 days

issue commentlostpebble/pullstate

Question: Update element within nested array

Hi @hohenp ,

Firstly, I just want to point out that you should usually use the second argument to update() when mapping over or searching on the state within your Store. This second argument is the same as the first- but its not using a proxy (the special object which allows us to directly mutate our state and get the changes), which will make it more performant to read and inspect. Not a big deal for small things, but over large collections you might notice something.

Could you maybe do something like this?:

const updatePlanningElementWithinTree = (meetingId: number, updatedPlanningElement: PlanningElement) => {
    // Notice I use "o" here, stands for the "original" un-proxied state
    PlanningViewStore.update((s, o) => {
         const meetingIndex = o.meetingsPlanningElements.findIndex(m => m.meetingId === meetingId);
         // might want to run validation that meetingIndex >= 0
         const planIndex = o.meetingsPlanningElements[meetingIndex].planningElements.findIndex(e => e.planningId === updatedPlanningElement.planningId);
         // might want to run validation that planIndex >= 0
         s.meetingsPlanningElements[meetingIndex].planningElements[planIndex] = updatedPlanningElement;
    });
};

Its usually best when updating a big tree like this, to try and get all the keys you need for the deep update (the indexes here) - and then apply the update exactly to those keys on the state (s.meetingsPlanningElements[meetingIndex].planningElements[planIndex] = updatedPlanningElement;).

Let me know if that helps, or if I missed something!

hohenp

comment created time in 2 days

issue commentlostpebble/pullstate

Could not resolve dependency peer react@"^16.12.0" from pullstate@1.20.1

Hi @pSnehanshu ,

This is unfortunately due to NPM version 7 being way more strict about peer dependency mismatches.

To get the old behaviour, run npm install with --legacy-peer-deps, as they say in the error message.

I'm not really sure how to solve this- as we don't want to throw errors for people who are using React ^16.12.0 - but there's no way for me to say that pullstate is also compatible with ^17.0.1 ... NPM and package.json is rather limited in this regard and its kinda silly because people are obviously going to run into loads of these errors- unless I'm mistaken and missing something.

pSnehanshu

comment created time in 2 days

push eventelixir-lang/elixir

Michał Łępicki

commit sha 6ecab05bcea33e2aacc1afd66edaff50e5f81517

Update Module.ParallelChecker.fetch_export/4 spec (#10772) The return type changed in 96661c6963cd75ba83f7c8f4ca01e798b4c6e724

view details

push time in 2 days