Skip to content

Instantly share code, notes, and snippets.

View MatthewDaniels's full-sized avatar

Matthew Daniels MatthewDaniels

  • Brisbane, Qld, Australia
View GitHub Profile
@MatthewDaniels
MatthewDaniels / Upload file to S3 - Multipart
Last active January 9, 2022 23:24
Use this as a structure to send a file to S3. It uses the AWS Javascript SDK - unfortunately, without using requires js, all other builds failed aside from the CDN provided version here: https://sdk.amazonaws.com/js/aws-sdk-2.2.33.min.js
// NOTE: it is suggested that you use very limited credentials
// a good solution is to create an IAM user in AWS that has only PUT rights to S3
// use a temporary bucket that has an expiry (24hrs or something low)
// once the file is uploaded get your server to move the file to another bucket that has much less
// restricted rights.
// See: readme for more info
// setup the credentials
AWS.config.update({
accessKeyId: accessKeyId,
@MatthewDaniels
MatthewDaniels / toType.js
Last active March 16, 2016 21:51
A better typeof implementation
/**
* A better typeof implementation.<br>
* This method will return a proper string for
* every object in javascript; including, but not limited to:
* 'array'
* 'arguments'
* 'error'
* 'date'
* 'regexp'
* 'json'
@MatthewDaniels
MatthewDaniels / IE7-8 Background Resize Mixin
Created February 19, 2013 01:14
Internet Explorer < version 9 background resize less mixin. An easy way to get css background-size: cover in internet explorer versions 8 and lower. Add it to your mixins less file and reference wherever you need it.
// used to make a background image (including alpha images) scale to the size of it's container in ie7 & ie8
.ie7-8-backgroundScale(@filename) {
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='@{filename}', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='@{filename}', sizingMethod='scale')";
}