Skip to content

Instantly share code, notes, and snippets.

View patsma's full-sized avatar
💭
Perfection is not attainable, but if we chase perfection we can catch excellence

Patryk Smakosz patsma

💭
Perfection is not attainable, but if we chase perfection we can catch excellence
View GitHub Profile
#!/bin/bash
# optimize-images: Universal image optimization script
# Usage: optimize-images [options] [input_path]
# If no input path is provided, uses current directory
# Options:
# -q, --quality JPEG/WebP quality (default: 82)
# -w, --width Maximum width (default: 1920, maintains aspect ratio)
# -f, --format Convert to format (jpg, png, webp)
# --help Show this help message
Principles of Programmer Productivity
"What one programmer can do in one month, two programmers can do in two months." — Fred Brooks
🧠 Spaced-repetition: Fine-grained Loading API in Nuxt
The best way to commit something to long-term memory is to periodically review it, gradually increasing the time between reviews 👨‍🔬
Actually remembering these tips is much more useful than just a quick distraction, so here's a tip from a couple weeks ago to jog your memory.
In Nuxt we can get detailed information on how our page is loading with the useLoadingIndicator composable:
# Project Specification Document
## 1. Project Basics
**Project Name:**
**Client:**
**Project Type:**
- [ ] Website
- [ ] Web Application
- [ ] E-commerce
- [ ] Landing Page
1. **DOM Access Timing**
Use Vue/Nuxt lifecycle hooks to ensure DOM readiness:
```vue
<script setup>
import { onMounted } from 'vue'
import gsap from 'gsap'
onMounted(() => {
// DOM is ready here for GSAP animations
@patsma
patsma / main.js
Created July 19, 2021 13:13
ScrollTrigger example
// "use strict";
window.addEventListener('load', () => {
(function () {
gsap.registerPlugin(ScrollTrigger);
gsap.set('body', {autoAlpha: 1})
gsap.set('html', {overflow: 'visible'})
[text* fname placeholder "First name*"][text* lname placeholder "Last name*"][email* email placeholder "Email address*"][text* tel placeholder "Telephone*"][text* city placeholder "City*"][text* postcode placeholder "Postcode*"][text company placeholder "Company"][text website placeholder "Website"][select country "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua and Barbuda" "Argentina" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia and Herzegowina" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "Brunei Darussalam" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Canada" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos Islands" "Colombia" "Comoros" "Congo" "the Democratic Republic of the Congo" "Cook Islands" "Costa Rica" "Cote d'Ivoire" "Croatia
Options -Indexes
<Files ~ '\.(env|json|config.js|md|gitignore|gitattributes|lock)$'>
Order allow,deny
Deny from all
</Files>
<Files ~ '(composer.json)$'>
Order allow,deny
Deny from all
</Files>
RewriteEngine on
@patsma
patsma / .htaccess
Created May 18, 2021 10:59
yoyo.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^wp-content/uploads/(.*) https://dev.yoyo-designs.com/wp-content/uploads/$1 [R=301,NC,L]
#This Apache config file was created by Duplicator Installer on 2021-05-18 00:49:17.
#The original can be found in archived file with the name .htaccess__[HASH]
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
convert image.jpg -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB image_converted.jpg