Skip to content

Instantly share code, notes, and snippets.

@adrifmonte
adrifmonte / shortenConstant.js
Created October 17, 2019 17:55
shorten constant to fit maximum length accepted by sentry
// shorten constant to fit maximum length accepted by sentry
const shortenConstant = (constantCaseString, maxlength = 25, separator = '_') => {
// no need to shorten
if (!constantCaseString || constantCaseString.length < maxlength) {
return constantCaseString;
}
// abbreviate each word to fit the max length
const splittedConstantCaseTokens = constantCaseString.split(separator);
if (splittedConstantCaseTokens.length > 1) {
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active July 19, 2024 18:06
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@lubien
lubien / A-umbrella.md
Last active September 7, 2023 17:45
Umbrella Challenge

Umbrella Challenge

Given a number of people N and an array of integers, each one representing the amount of people a type of umbrella can handle, output the minimum number of umbrellas needed to handle N people.

No umbrella could have left spaces. Which means if a umbrella can handle 2 people, there should be 2 people under it.

If there's no solution, return -1.

Examples