Skip to content

Instantly share code, notes, and snippets.

View ruandre's full-sized avatar

Ruandré Janse van Rensburg ruandre

View GitHub Profile
@ruandre
ruandre / s3-bucket-exists.js
Last active February 8, 2022 05:36
Check if S3 bucket exists using AWS SDK JavaScript Node.js
const AWS = require('aws-sdk')
const s3 = new AWS.S3()
const BUCKET_NAME = 'MyBucket'
async function main() {
try {
const data = await s3.headBucket({ Bucket: BUCKET_NAME }).promise()
return `Bucket "${BUCKET_NAME}" exists`
@ruandre
ruandre / boiler.html
Last active September 21, 2021 19:08
HTML Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title></title>
<!-- <meta name="robots" content="noindex,nofollow"> -->
<meta name="description" content="">
<meta name="theme-color" content="#fff">
@ruandre
ruandre / PsResizeLongestSide1024.jsx
Last active February 7, 2022 18:15
Adobe Photoshop script to resize images to fit inside a 1024px box.
/***************************
NOT MAINTAINED! from ~2015
****************************/
// photoshop script to resize images proportionally to fit inside a 1024px box i.e. longest side/edge will equal 1024px
// useful when scaling down many large photos for web use, simply toss in a batch action
var activeDoc = app.activeDocument
var docWidth = activeDoc.width
var docHeight = activeDoc.height
@ruandre
ruandre / AiFitToArtboard.jsx
Last active July 19, 2022 12:16
Adobe Illustrator script to resize objects proportionally to fit inside the artboard.
/***************************
NOT MAINTAINED! from ~2014
****************************/
// cs4+ script for resizing objects proportionally to fit inside artboard
// based on: https://forums.adobe.com/message/4164590
// usage: create a new document with desired artboard size, paste object, select it, run this script
// bugs: centering does not work after changing artboard size
var activeDoc = app.activeDocument