Skip to content

Instantly share code, notes, and snippets.

View dbalatero's full-sized avatar

David Balatero dbalatero

View GitHub Profile
def removeZeroes(nums: list[int]) -> list[int]:
count = len(nums)
left = 0
while left < count and nums[left] == 0:
left += 1
right = count - 1
while right > left and nums[right] == 0:
right -= 1
/**************/
/**/ /**/
/**/ /**/
/**/ /**/
/**/ KC_CTRL /**/,
/**/ /**/
/**/ /**/
/**/ /**/
/**************/
const replaceZeros = (str) => {
return str.replaceAll(/0+/g, (match) => {
return match.length.toString();
});
};
console.log(replaceZeros('1234500362000440') === '1234523623441');
console.log(replaceZeros('123450036200044') === '123452362344');
console.log(replaceZeros('000000000000') === '12');
console.log(replaceZeros('123456789') === '123456789');
{
"openapi": "3.0.0",
"info": {
"title": "Demo API",
"description": "The Demo API is not a real API.",
"version": "1.0.0"
},
"paths": {
"/users": {
"post": {
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
/**
* Many more examples available at:
@dbalatero
dbalatero / 01_README.md
Last active June 19, 2022 22:00
This code lets you find possible bad spots where ts-expect-error is hiding real errors in your code.

There is an issue with // @ts-expect-error where it can hide other errors inside of:

  • React property assignments
type Props = {
  foo: string;
  baz: number;
}
local Remapper = {}
function Remapper:new()
local remapper = {}
setmetatable(remapper, self)
self.__index = self
remapper.keyMaps = {}
remapper.eventTap = remapper:_createEventTap()
# some pdf file
def applicant_name
{ "form[0].applicant[1].name" => answers.applicant.name }
end
def applicant_email
{ "form[0].applicant[1].email" => answers.applicant.email }
end
#!/usr/bin/env bash
# Got these from the event that reads like:
# "dbalatero force-pushed the my-feature-branch branch from 7c66458 to c559af0"
old_head=7c66458
new_head=c559af0
echo "CASE 1: A force-pushed branch that has no branch changes, just the latest master"
echo " e.g. they just did git rebase master && git push --force-with-lease"
echo