Skip to content

Instantly share code, notes, and snippets.

View stevepentler's full-sized avatar

Steve Pentler stevepentler

View GitHub Profile
EXTENSION_TO_MIMETYPE_MAP = {
"3fr" => "image/x-hasselblad-3fr",
"aa" => "audio/audible",
"aae" => "application/vnd.apple.photos",
"ai" => "application/vnd.adobe.illustrator",
"aiff" => "audio/x-aiff",
"alias" => "application/x-macos",
"ape" => "audio/x-monkeys-audio",
"apng" => "image/apng",
"asf" => "video/x-ms-asf",
@stevepentler
stevepentler / SVC_FILEMOVER.md
Created January 17, 2020 00:33
Filemover Service

FILEMOVER

Labels

  • whole path is saved to array, ending in it's own key.
  • can lookup parent/children very easily with scopes
  • adding/querying is easy & fast, but rearrangment gets more complicated
  • belong to Brandfolder
  • soft deleted (all children soft deleted too)
  • api/v4/(brandfolders || collections)/:key/labels
  • #index (see permissions section below)
A. GIF doubled in size for standard image, 6.7KB => 13.2
- fully supported
- no gains for standard images without significant blocks of color
B. WebP was reliably 2/3 original size. 26.3KB => 17.8
- only works in Chrome/Opera, Firefox is considering support but I wouldn't count on it
- would require backfilling webp data (but for large/trafficked orgs this could be worthwile)
- JS side - detect chrome/opera, change AWS extension to .webp
- Save on AWS feeds, speed up lazy loading and UX considerably
- Couldn't find a functional polyfill for unsupported browsers (webp-hero package)
- Don't want conditional responses (one persion receives one extension, another a different extension) from the API, so would prefer to keep on front end
@stevepentler
stevepentler / AssetsService.md
Last active February 9, 2018 21:41
Assets Service

1. Clean up the is_authorized? method (referenced by readable_by?/collabable_by?)

  • We inconsistently implement has_guest_password_access_to, so centralizing this will be helpful
  • has_guest_password_access_to belongs in authorization methods instead of an asset scope

2. We need to correct the expectation that we only made one query in the past, and we only need one query/scope in the future

@stevepentler
stevepentler / availability.txt
Last active January 30, 2018 22:06
Availability
Availability:
Purpose:
- Assets contain their own state without any additional calls/relationships.
- single scope for assets, based on single field on Asset
- scale up features AND quicken load times
- clean up logic in views
Goals:
1. Expire Assets
@stevepentler
stevepentler / filestack_v3.js
Last active December 15, 2017 23:20
Filestack V3 with BF settings
client.makeDropPane({
id: "dropZone",
overlay: false,
disableClick: true,
customText: "Drag and drop your pizza here",
onDragEnter: evt => console.log(evt),
onDragLeave: evt => console.log('leaving'),
onDrop: evt => console.log(evt),
onSuccess: function(files) {console.log('pizza delivery');},
onClick: function() {
  • event when users are added/deleted

  • event when deleting asset

  • event when deleting attachment

  • attachment recovery

  • log searches to insights -> new page

  • filter by collections

  • share links

➜ boulder git:(EditShareLinks) git push staging EditShareLinks:master
Counting objects: 398, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (237/237), done.
Writing objects: 100% (398/398), 42.45 KiB | 0 bytes/s, done.
Total 398 (delta 315), reused 205 (delta 156)
-----> Building boulder...
remote: No submodule mapping found in .gitmodules for path 'services'
-----> Unable to select a buildpack
remote: ERROR: Build failed: exec: job exited with status 1
install RVM
Fiddle with your .bash_profile (I can send you what you need if you don’t already have it)
run the following stuff in order:
rvm requirements
rvm pkg install readline
rvm pkg install iconv
rvm pkg install zlib
rvm pkg install openssl