Skip to content

Instantly share code, notes, and snippets.

View nicolas-cusan's full-sized avatar

Nicolas Cusan nicolas-cusan

View GitHub Profile
@nicolas-cusan
nicolas-cusan / batch-resize-mac.sh
Last active November 3, 2021 09:27
This script finds all the images in a folder (and its subfolders) that are larger than 3MB, resizes them to have a maximum size of 3000px on the longest side and replaces the original image file.
#!/bin/bash
# This script finds all the images in a folder (and its subfolders) that are larger than 3MB,
# resizes them to have a maximum size of 3000px on the longest side and replaces the original image file.
# Usage: > sh ./batch-resize-mac.sh ./path/to/folder
# Info: https://ss64.com/osx/sips.html
# Credit: https://gist.github.com/lopespm/893f323a04fcc59466d7
initial_folder="$1"
all_images=$(find -E $initial_folder -iregex ".*\.(jpg|gif|png|jpeg)")
@nicolas-cusan
nicolas-cusan / position-mixin.scss
Last active April 9, 2018 16:48
Sass position mixin to generate position properties in shorthand form.
//============================================
// Position Mixin
//============================================
// Generate position properties in shorthand form.
//
// @param {List} $values - List of numbers or `auto`
// @param {List} $sides - List of sides (`top`, `left`, `bottom`, `right` or `all`)
// @param {String} $pos - Position keyword or `none`
// @param {Bool} $auto-overwrite - If `true` all non specified $sides will be set to `auto`