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 / JsPrettier.sublime-settings.json
Last active March 8, 2023 14:42
My personal Sublime Text settings
{
"auto_format_on_save": true,
"auto_format_on_save_excludes": [
"*/node_modules/*",
"*.json",
"*.md",
"*.html",
"*.min*"
],
"prettier_options": {
@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 / PULL_REQUEST_TEMPLATE.md
Last active March 10, 2021 14:59
Nice templates for GitHub repos - readme, pr and issue templates...

What is the goal of this change?

(answer here)

Is there any issue related?

(answer here)

How does the changes address the issue?

(answer here)

Checklist

@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 / sizes.scss
Last active February 16, 2023 00:18
Useful screen sizes and viewports breakpoints
$screens: (
'hd': 1280px; // 1280 x 720
'fullhd': 1920px; // 1920 x 1080
'2k': 2048px; // 2048 x 1080
'4k': 3840px; // 3840 x 2160
'8k': 7680px; // 7680 x 4320
'10k': 10240px; // 10240 x 4320
);
$viewports: (
@jlozovei
jlozovei / elementOffset.js
Created July 8, 2020 22:03
Get an element's top/left offset relative to the document
function elementOffset(element) {
const rect = element.getBoundingClientRect();
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return {
top: rect.top + scrollTop,
left: rect.left + scrollLeft
};
@jlozovei
jlozovei / scripts.sh
Last active May 17, 2021 18:01
Run babel-node with npx
# replace <filename> with your JS file name
npx -p @babel/core -p @babel/node babel-node --presets @babel/preset-env <filename>.js
@jlozovei
jlozovei / getVideoID.php
Last active February 14, 2023 16:10
Get the ID from YouTube or Vimeo videos
/**
* Get video ID from YouTube URL
*/
function get_id_from_youtube($url) {
parse_str(parse_url($url, PHP_URL_QUERY), $querystring);
return $querystring['v'];
}
@jlozovei
jlozovei / readme.md
Created November 13, 2019 19:58
Data Visualization links