Skip to content

Instantly share code, notes, and snippets.

View jlozovei's full-sized avatar
👨‍💻
Need a bug? Talk to me!

Julio Lozovei jlozovei

👨‍💻
Need a bug? Talk to me!
View GitHub Profile
@jlozovei
jlozovei / settings.json
Created March 2, 2024 01:52
My personal Zed settings
{
"theme": "Ayu Dark",
"base_keymap": "SublimeText",
"ui_font_size": 18,
"buffer_font_size": 18
}
@jlozovei
jlozovei / FadeInOut.js
Last active February 9, 2024 17:23
FadeInOut React component
import { useState, useEffect } from 'react';
import './styles.css';
const stages = {
unmounted: 'unmounted',
entering: 'entering',
entered: 'entered',
completed: 'completed',
exiting: 'exiting',
@jlozovei
jlozovei / context.js
Created October 27, 2023 14:09
React + RTL context injection
// context/index.js
import { useReducer, useEffect, useMemo, createContext } from 'react';
import { reducer1, reducer2, reducer3 } from './reducers';
const Context = createContext({});
const STORAGE_KEY = 'my_awesome_storage'
const defaultState = {
user: {
@jlozovei
jlozovei / docker.sh
Created July 28, 2023 17:24
Useful Docker scripts
# Clean cache and hard stop
docker system prune -a
@jlozovei
jlozovei / grid.css
Created June 26, 2023 18:30
Grid layout using CSS grid
:root {
--columns: 16;
}
.grid {
grid-template-columns: repeat(var(--columns), [col-start] 1fr);
}
@jlozovei
jlozovei / settings.json
Last active April 28, 2023 14:48
My personal VSCode settings
{
"window.title": "${dirty} ${activeEditorMedium}${separator}${rootName}",
"editor.fontSize": 18,
"editor.tabSize": 2,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
@jlozovei
jlozovei / _document.js
Created March 14, 2023 16:41
Next + styled-components
import { Html, Head, Main, NextScript } from 'next/document';
import { ServerStyleSheet } from 'styled-components';
export default function Document() {
const getInitialProps = async (ctx) => {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;
try {
ctx.renderPage = () =>
@jlozovei
jlozovei / scripts.sh
Created February 16, 2023 20:50
Useful scripts when developing with React Native
# Check info about the development environment
npx react-native info
@jlozovei
jlozovei / instructions.md
Created February 14, 2023 16:46
Coding interviews exercises and solutions
  1. Create a function that divides an array of numbers into odd and even.

Input: [0, 1, 2, 3, 4, 5]

Output: { odd: [0, 2, 4], even: [1, 3, 5] }

  1. Create a function that verifies how many times a number is repeated within an array.

Input: [0, 1, 1, 2, 3, 4, 5, 2, 3, 5, 7, 8, 6]

Output: Number X is repeated Y times

@jlozovei
jlozovei / debounce.js
Created February 14, 2023 16:21
Useful JS scripts and snippets
const debounce = (func, delay) => {
let inDebounce;
return function() {
const context = this;
const args = arguments;
clearTimeout(inDebounce);
inDebounce = setTimeout(() => func.apply(context, args), delay);