Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Coding for life and fun

Jakub Zomerfeld devzom

:octocat:
Coding for life and fun
View GitHub Profile
@devzom
devzom / zsh-aliases.txt
Last active Nov 16, 2022
zsh: custom aliases
View zsh-aliases.txt
# ZSH
alias zshconfig="open ~/.zshrc"
alias zshsave="source ~/.zshrc"
alias ohmyzsh="open ~/.oh-my-zsh"
# Machine's ip address
alias ip="ipconfig getifaddr en0"
@devzom
devzom / generateEnvExample.sh
Last active Oct 25, 2022
Create .env.dev example file structure based on .env file
View generateEnvExample.sh
#!/bin/bash
# (generate only keys, without values)
sed 's/=.*/=/' .env > .env.dev
@devzom
devzom / git-remove-file-from-whole-history.bash
Created Jul 28, 2022
git: Remove specific file from whole git history
View git-remove-file-from-whole-history.bash
git rm --cached --ignore-unmatch filePath --prune-empty --tag-name-filter cat -- --all
@devzom
devzom / style.css
Created Mar 19, 2022
CSS: Remove focus outline (when not using keyboard)
View style.css
// removing the focus outline when not using
//keyboard navigation (the CSS :focus-visible selector is polyfilled here).
*:focus:not([data-focusvisible-polyfill]){
outline: none;
}
@devzom
devzom / read-env.sh
Created Mar 16, 2022
bash: Read .env file variable in Bash
View read-env.sh
# this will skip search for lines with variable starting with # (hashtag) ex: # VAR1 as its commented out
# Ex: we have .env file with variables:
# #VAR1=123
# VAR2=xyz
# NPM_TOKEN=12312323fdf21313
export "$(grep -vE "^(#.*|\s*)$" .env)"
# didn't respond VAR1 as it contain #, so it's commented out.
# responds with single value ex NPM_TOKEN:
@devzom
devzom / docker-check-container.sh
Last active Mar 16, 2022
docker: Check if Docker container exist and delete it
View docker-check-container.sh
# Goal of tghis script is to prompt for Docker container name, if it's skipped it will used infile defined name of container and then will search for specific container and delete it.
# Set container default name as variable
CONTAINER=testContainerName
echo -n "Enter Docker container name (if skipped default from file will be used): "
read containerName
# Check if prompted value isNotEmpty
if [ $containerName ]; then
@devzom
devzom / index.html
Last active Mar 16, 2022
CSS: Animated smooth anchor scroll with anchor margin
View index.html
<!-- step 3 -->
<!-- It's important to add tabindex="-1" to all anchor tags -->
<section id="section1" tabindex="-1">Section 1</section>
@devzom
devzom / nuxt_JSON-LD_head-SEO.js
Created Mar 5, 2022
Nuxt: Add JSON-LD schema markup for SEO in Nuxt.js
View nuxt_JSON-LD_head-SEO.js
data(){
return ({
description:'Description of the site'
})
}
head(){
return({
title: 'Home page',
meta: [
{
@devzom
devzom / generate-seo-robots-agents-sitemap.js
Last active Jan 19, 2022
JS: Nuxt: Generate sitemap UserAgent based on provided array
View generate-seo-robots-agents-sitemap.js
/*
* @created: 18/12/2021
* @author Jakub [dev.zomerfeld@gmail.com]
* @summary Utils funtion to generate an array of
* UserAgents provided in structured schema
* to use with Robots Nuxt module https://github.com/nuxt-community/robots-module
*/
const agentsArray = [
'Abonti',
@devzom
devzom / compareEnvs.js
Created Jan 14, 2022
javascript: Function to compare different .env files
View compareEnvs.js
/*
* Created: 14/1/2022 by Jakub Zomerfeld / dev.zomerfeld@gmail.com
*/
const fs = require('fs')
const path = require('path')
const dotenv = require('dotenv')
/**
*