Skip to content

Instantly share code, notes, and snippets.

@dikaio
dikaio / aspect-ratio.sh
Created July 14, 2023 11:41
Little Bash Script that crops photos to 5:3 and 3:5 aspect ratios. Perfect ratio's for displaying on the web.
#!/bin/bash
# Path to the folder containing the .jpg photos
folder_path="./photos"
total_files=$(find "$folder_path" -type f -name "*.jpg" | wc -l)
current_file=0
echo "Processing photos..."
@dikaio
dikaio / convert.md
Created July 3, 2023 05:23
One line command to bulk convert image sizes as long as their are greater than the size being converted to.

find . -type f -name "*.jpg" -exec identify -format '%w %i\n' "{}" \; | awk '$1 > 800 {print $2}' | xargs -I {} convert "{}" -resize 800x "{}"

@dikaio
dikaio / convert.md
Last active July 3, 2023 04:46
Simple one-line command to batch convert jpeg to jpg and keep the same filename.

Simple one-line command argument to batch convert images.

for file in *.jpeg; do filename="${file%.*}"; convert "$file" "${filename}.jpg"; done

@dikaio
dikaio / remove-between-tags.md
Created June 25, 2023 09:33
Regex to remove anything within tags

You can use the following regular expression to find and remove all text within the <picture></picture> tag in Visual Studio Code:

  1. Press Ctrl+Shift+F or Cmd+Shift+F (on Mac) to open the "Find in Files" panel.

  2. Click on the gear icon to show the search options.

  3. Tick the "Use Regular Expression" checkbox.

  4. In the "Find" field, enter this regular expression:

@dikaio
dikaio / README.MD
Created May 19, 2023 22:12 — forked from RichardBronosky/README.MD
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@dikaio
dikaio / tailwind.config.js
Created April 25, 2023 22:46
HelpScout color pallette for tailwindcss
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [],
darkMode: ["class"],
theme: {
colors: {
transparent: "transparent",
current: "currentColor",
white: "#ffffff",
black: "#000000",
@dikaio
dikaio / wealth-preservation.md
Created April 20, 2023 21:46
There's a reason why you people pay more in taxes to the U.S. Government than the most wealthy people in the world. Learn.

Wealth Preservation

The rich avoid taxes with a strategy “Buy, Borrow, Die”:

  1. Buy assets & hold (to avoid capital gains tax)

  2. Use assets as collateral to borrow money (while assets appreciate)

  3. Interest paid on loans is a tax deduction

@dikaio
dikaio / fetch-strategies.tsx
Created April 20, 2023 02:29
Example nextjs fetch strategy using both SSG and SSR
import Image from 'next/image'
import { Layout, Text, Page, Code, Link, List } from '@vercel/examples-ui'
import { GetStaticProps } from 'next'
import useSWR from 'swr'
import { useEffect, useState } from 'react'
import board from '../public/board.jpg'
interface Product {
id: string
@dikaio
dikaio / i18n.md
Last active April 17, 2023 01:27
Internationalization

Internationalization

North America

  • United States
    • English: en-US
  • Canada
    • English: en-CA
  • Mexico
  • Spanish: es-MX
@dikaio
dikaio / header-ux.tsx
Created April 11, 2023 00:32
Simple Fade in Fade out navigation menu using framer motion
"use client"
import { useEffect } from "react"
import Link from "next/link"
import {
motion,
useMotionTemplate,
useMotionValue,
useScroll,
useTransform,