
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
Sort array of objects or numbers into a grid where items are sorted from biggest to lowest
In CSS there are multiple ways to achieve stunning layouts, the most populare systems to achieve this are Grid and Flex layout systems. These systems provide you with a set of properties to define layouts, however they depend on the order of the elements in the dom.
For simple binary choices this is great, however we may want a grid layout where elements fill the horizontal space based on items size. The ideal concept would be that grid or flex had properties to lay out items respecting their intrinsic size from greatest to lowest size, and filling out the gaps with items with smaller size. I've tried to achieve this with only css but haven't come up with a way, so I decided to reach out to JavsScript and sort the items in that same manner,
Given a list of numbers:
const list = [3, 2, 1, 2, 3, 1, 1, 1];
In a 4 column grid I'd like to have them sorted like this:
const sortedList = [
[3, 1],
[1, 3],
[2, 2],
[1, 1],
];
Rows are filled with items that fill the 4 column rule, they are filled with biggest items first, and the space left with the next biggest item. Rows compared themselves to the previous one to achieve a varied visual composition.
FAQs
Sort objects in a two dimensional array to compose grids based on a condition
The npm package grid-sort receives a total of 17 weekly downloads. As such, grid-sort popularity was classified as not popular.
We found that grid-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.