Skip to content

Instantly share code, notes, and snippets.

View peguerosdc's full-sized avatar

Carlos Pegueros peguerosdc

View GitHub Profile
@peguerosdc
peguerosdc / permutations.py
Created September 13, 2023 20:22
Recursive DFS implementation of itertools.permutations
from collections.abc import Iterable, Sized
def cycle_last_n(items: Sized, n: int):
prefix, to_cycle = items[:-n], items[-n:]
for _ in range(n):
yield prefix + to_cycle
to_cycle = to_cycle[1:] + to_cycle[:1]
def _permutations(items: Sized, n: int):
if n == 1:
client_id cat_one cat_two cat_three
1 1 A AA 2
2 2 A AA 2
3 3 A BB 1
4 4 A BB 1
5 5 B BB 2
@peguerosdc
peguerosdc / README.md
Last active July 2, 2020 04:31
CRA + RSuite + webpack-multiple-themes-compile

This is an example on how to make webpack-multiple-themes-compile work with create-react-app.

I'd consider this really a hack as some things have to be changed in the default webpack configuration, so there are a few issues:

  1. When adding the new entry points for the themes (i.e. for theme-custom.css), the original entry points have to be re-shaped and as a result (at least in my build) the first run of the application results in a blank page, but after the reloading everything works as expected.
  2. The number of themes that can be added is limited as the compiler runs out of memory very soon. I think this may be because of how CRA manages the entry points under the hood and we are messing with it with this hack.

Apart from these, I haven't found any issues neither in my dev nor production environments.