This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "Demo API", | |
"description": "The Demo API is not a real API.", | |
"version": "1.0.0" | |
}, | |
"paths": { | |
"/users": { | |
"post": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", (event) => { | |
event.respondWith( | |
handleRequest(event.request).catch( | |
(err) => new Response(err.stack, { status: 500 }) | |
) | |
); | |
}); | |
/** | |
* Many more examples available at: |
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;
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Remapper = {} | |
function Remapper:new() | |
local remapper = {} | |
setmetatable(remapper, self) | |
self.__index = self | |
remapper.keyMaps = {} | |
remapper.eventTap = remapper:_createEventTap() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder