Skip to content

Instantly share code, notes, and snippets.

View washingtonsoares's full-sized avatar
🎯
Focusing

Washington Soares washingtonsoares

🎯
Focusing
View GitHub Profile
!function() {
var d3 = {
version: "3.5.17"
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
};
var d3_document = this.document;
function d3_documentElement(node) {
return node && (node.ownerDocument || node.document || node).documentElement;
import React, { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { findMatchedKey } from './keyEvents';
let exclusiveHandlers = [];
const KeyboardEventHandler = ({
handleKeys = [],
handleEventType = 'keydown',
handleFocusableElements = false,
import { useEffect, useRef } from "react";
export default function FormWithoutState() {
// The count will increment by 2 on initial render due to strict mode then by 1 on subsequent renders
const countRef = useRef(0);
useEffect(() => {
countRef.current = countRef.current + 1;
});
@washingtonsoares
washingtonsoares / unemploymentRates.js
Created August 21, 2023 13:31
unemploymentRates.js
{
"data": [
{
"State": "Vermont",
"unemploymentRateRank": 1,
"unemploymentRate": "0.0210",
"Pop": 628061
},
{
"State": "North Dakota",
/*
We are building a word processor and we would like to implement a "word-wrap" functionality.
Given a list of words followed by a maximum number of characters in a line, return a collection of strings where each string element represents a line that contains as many words as possible, with the words in each line being concatenated with a single '-' (representing a space, but easier to see for testing). The length of each string must not exceed the maximum character length per line.
Your function should take in the maximum characters per line and return a data structure representing all lines in the indicated max length.
Examples:
words1 = [ "The", "day", "began", "as", "still", "as", "the",
import * as React from "react"
export function useDebounce<T>(value: T, delay?: number): T {
const [debouncedValue, setDebouncedValue] = React.useState<T>(value)
React.useEffect(() => {
const timer = setTimeout(() => setDebouncedValue(value), delay || 500)
return () => {
clearTimeout(timer)
@washingtonsoares
washingtonsoares / gist:faad6e94de6543b4606ed68bc55390d1
Created January 24, 2023 18:00
Rename all .js React component files to .jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l "</\|/>" $0' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
testCount = 0
while True:
try:
n = int(input())
if (n == 0):
break
if (testCount > 0):
print("")
while True:
try:
text = input()
shortcuts = []
resultText = ""
for i in range(len(text)):
currentChar = text[i]
if (currentChar == "_"):
if (len(shortcuts) > 0 and shortcuts[-1] == "_"):
# https://www.beecrowd.com.br/judge/pt/problems/view/1222
while True:
try:
wordsLength, maxLinesPerPage, maxCharPerLine = map(int, input().split(" "))
shortStory = input()
lines = 0
pages = 0