Skip to content

Instantly share code, notes, and snippets.

@doooby
doooby / cube_mod_alg.rb
Created January 5, 2021 16:22
it modifies a rubic's cube algorithm
# Usage: cube_mod_alg.rb operation algorithm
# operations can be chained: "op1 | op2"
# algorithm suports basic moves written in standard notaion: "D'L' B'L BD "
# left hand fingers up, palm-away
# thumb = +x
# fingers = +y
# palm = +z
WORLD_AXES = {
x: [ :blue, :green ].freeze,
@doooby
doooby / info.md
Last active August 29, 2015 14:13
Direct (POST) uploading to AWS S3 using aws-sdk gem

Direct uploading to AWS S3

Since there are new regions of Amazon S3 services that accepts only Signature v4 (e.g. frankfurt) you cannot use aws-sdk-v1 gem's #presigned_url functionality. And newer aws-sdk gem (beeing stil in preview for 2.x) doesn't have a functionality to do direct uploading either. Here's my inplementation of that functionality, build on top of aws-sdk v2.0.16.pre and jquery (it's using some javascript stuff that older browsers won't support though).

For some basic information see this Heroku's Direct to S3 Image Uploads in Rails article https://devcenter.heroku.com/articles/direct-to-s3-image-uploads-in-rails . A "how to" by Amazaon itself in Authenticating Requests in Browser-Based Uploads Using POST (AWS Signature Version 4) http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html (notice beelow are subsections of details, like how to create signing policy).

An exapmle for simultaneous multiple images browser-based uploading

So, I build it the way,