Skip to content

Instantly share code, notes, and snippets.

View benyarb's full-sized avatar

Ben Yarbrough benyarb

View GitHub Profile
@benyarb
benyarb / base64uploads.md
Created September 13, 2024 03:54
Base64 Image Uploads

Using Base64 encoding for image uploads on the client side and sending it to the server can work, but there are several important security, performance, and reliability implications to consider:

1. Performance Impact

  • Increased Payload Size: Base64 encoding increases the size of the image by approximately 33%. This means that your upload size will be larger than the original image file, resulting in slower uploads and more bandwidth usage.
  • Client-Side Processing: Encoding an image to Base64 on the client side can be computationally expensive for large images, potentially affecting the performance of your app, especially on mobile devices or low-powered clients.

2. Security Considerations

  • Lack of File Integrity Checks: Base64 does not inherently provide any mechanisms for verifying the integrity of the file. If the encoding process or transmission is corrupted, the image might be unusable on the server side.
  • Cross-Site Scripting (XSS) Risks: If not properly
@benyarb
benyarb / gist:770fa8ad53e2546043fe9cf9a457f548
Created September 13, 2024 03:52
Base64 Image Uploads
Using Base64 encoding for image uploads on the client side and sending it to the server can work, but there are several important security, performance, and reliability implications to consider:
### 1. **Performance Impact**
- **Increased Payload Size**: Base64 encoding increases the size of the image by approximately 33%. This means that your upload size will be larger than the original image file, resulting in slower uploads and more bandwidth usage.
- **Client-Side Processing**: Encoding an image to Base64 on the client side can be computationally expensive for large images, potentially affecting the performance of your app, especially on mobile devices or low-powered clients.
### 2. **Security Considerations**
- **Lack of File Integrity Checks**: Base64 does not inherently provide any mechanisms for verifying the integrity of the file. If the encoding process or transmission is corrupted, the image might be unusable on the server side.
- **Cross-Site Scripting (XSS) Risks**: If not properly
@benyarb
benyarb / BallerzAPI.md
Last active February 10, 2023 23:39
Unofficial Ballerz API Docs

Unofficial Ballerz API

Basic URL: https://ballerz.cloud/images/ballerz/7562/public

URL with params: https://ballerz.cloud/images/ballerz/7562/background=red,rotate=180,sharpen=2,trim=50;60;100;90

@benyarb
benyarb / api-resource-search.js
Created February 25, 2018 03:29
API Resource Search
Vue.component('resource-search', {
props: {
selected: [],
selectedData: [],
resourceName: '',
searchTarget: '', // which property on the resource to search
haystackLimit: [],
},
data() {
@benyarb
benyarb / facebotCommands.textile
Last active August 29, 2015 13:56
Facebot Commands

Facebot Commands

Get

[spotify link] returns info about the link (track, artist, etc.)
[dribbble URL] brings up image from the URL
face google me [query] Googles [query] & returns 1st result’s URL
face wiki me [query] Searches for [query] on Wikipedia.
face youtube me [query] Searches YouTube for the query and returns the video embed link.
face map me [query] Returns a map view of the area returned by `query`.
@benyarb
benyarb / zshProjectAliasConventions.zsh
Last active August 29, 2015 13:56
ZSH Project Alias Convention
#-----------------
# Projects
#-----------------
## convention:
# cmd: [c|g|w|u|r*] [proj]
# c: cd
# 'cd [proj]'
# g: git
# 'cd [proj], git pull, git status'
@benyarb
benyarb / vimium_colemak
Last active October 23, 2024 02:27
Vimium Colemak Keybindings
# Custom key mappings
map n scrollDown
map N previousTab
map e scrollUp
map E nextTab
map i scrollRight
map I goForward
@benyarb
benyarb / .bashrc
Created May 15, 2012 21:55
My .bashrc File (Mac)
# ~/.bashrc
#----------------
# Aliases
#----------------
# Prompt overwrites
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
@benyarb
benyarb / .bash_profile
Created May 15, 2012 21:20
Import .bashrc into .bash_profile
# ~/.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@benyarb
benyarb / .bashrc
Created May 15, 2012 20:13
A .bashrc function for creating and entering a directory.
# ~/.bashrc
function mkcd {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}