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 / .zshrc
Last active April 13, 2024 04:10
Oh My Zsh config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/jlozovei/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@jlozovei
jlozovei / scripts.sh
Last active April 3, 2024 21:08
Cool git scripts to get some info on a codebase
# Get codebase total lines (all files)
git ls-files | xargs wc -l
# Get codebase total lines (ignore files with extension)
git ls-files -- . ':!:*.md' | xargs wc -l
# Get codebase total lines (files matching a extension)
git ls-files -- '*.js' | xargs wc -l
# Get total lines of a codebase, by user
@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 / scripts.sh
Last active May 18, 2023 13:04
Useful scripts and commands to use while writing tests with Jest
# run a single spec with jest
# -- replace <spec> with the spec's name (i.e. Button)
jest -t='<describeString> <itString>'
npm run test -- -t '<describeString> <itString>'
# run a single spec using file path
# -- replace <path> with the file's path (i.e. src/tests/test.js)
jest <path>
# clear cache
@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 = () =>