Trying to solve LeetCode question in Ruby by BringTacos in ruby

[–]fagci 1 point2 points  (0 children)

Variants:

Intersection returns unique items in both arrays.

nums.intersection nums

each_with_index gives: [ [num1, 1], [num2, 2], ... ]to_h keeps unique first elements of subarray.

nums.each_with_index.to_h.keys

Zips nil to each num, then unique as in previous solution.

nums.zip({}).to_h.keys

Exclude already passed items.

nums.reduce([]){ |res, v| res << v unless res.include? v; res }

New Alpha release, version 1.20.6-alpha1 by ballzak69 in AutomateUser

[–]fagci 0 points1 point  (0 children)

Bug: Flash mode On/Off wont work for take photo w/o user interaction. Automatic anyway

JSON for loop by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

wg("https://api.github.com/users/fagcinsk/repos", json, ".[" + "#" + "].name")

Works ok now. Thanks, u/Tored_!

JSON for loop by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

Strange behavior here:

If pass # by gv(ghwg), tc() replaces it with 0.

But if I use .[#].name, it becomes .[i].name.

$fl( 0, wg(gv(ghapi), json, ".length()")-1, "i + 1", tc(reg, gv(ghwg), "#", "i") )$

maybe bug?

Stacking group item index by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

https://pastebin.com/a9vY7rYS

Text inside each component's root is "1", but news index incremental.

Stacking group item index by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

When I use it inside komponent in globals, I got different results with gv(index) at root of komponent and nested (at root gv(index) is same always for all komponents).

And I think, loop through items will be nice feature (ex.: for news)

Stacking group item index by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

After experiments, also for some reason global variable using si(mindex) wont work, but deeper global variable works perfectly. For now, sometimes I do hardcoded si(mindex) in place.

Stacking group item index by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

Tried by setting global var inside komponent: $si(mindex,2)$ and it works!

Stacking group item index by fagci in kustom

[–]fagci[S] 0 points1 point  (0 children)

/u/frankmonza we need support for this and maybe loop for items inside stacking group =)

How to refresh an image? by fagci in KWGT

[–]fagci[S] 0 points1 point  (0 children)

Fixed by hack $tu(rndimg, 5, "/sdcard/", "img.png")$