brew
https://github.com/homebrew/brew
Ruby
🍺 The missing package manager for macOS
#truncate_text_to_approximate_size
Truncates a text string to fit within a byte size constraint, preserving character encoding validity. The returned string will be not much longer than the specified max_bytes, though the exact shortfall or overrun may vary.
Edit
git clone [email protected]:homebrew/brew.git
cd brew
open Library/Homebrew/utils.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs--truncate_text_to_approximate_size-for-pr
# Commit to gitgit add Library/Homebrew/utils.rbgit commit -m "better docs for #truncate_text_to_approximate_size"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs--truncate_text_to_approximate_size-for-pr
hub pull-request
# Celebrate!