Skip to content

Instantly share code, notes, and snippets.

View iconifyit's full-sized avatar
🏠
Working from home

Scott Lewis iconifyit

🏠
Working from home
View GitHub Profile
@iconifyit
iconifyit / authorize-plugin.sh
Created August 12, 2022 13:49
Authorize un-signed Adobe Illustrator plugin
# Update the path to Illustrator to match your system.
# This command is Mac OS only.
sudo xattr -r -d com.apple.quarantine /Applications/Adobe\ Illustrator\ 2022/Plug-ins/PlacedItemInfo.aip
@iconifyit
iconifyit / download-from-s3.sh
Created January 18, 2022 15:50
Script to download files from AWS S3 to a specified location.
#!/usr/bin/env bash
# Replace the text PATH_TO_YOUR_DROPBOX_FOLDER with the path to your Dropbox folder (e.g. /home/user/Dropbox)
DROPBOX_FOLDER="PATH_TO_YOUR_DROPBOX_FOLDER"
# DO NOT CHANGE ANYTHING BELOW THIS LINE
# ======================================
PDF_MERGE_WORK_FOLDER="$HOME/pdfmerge"
@iconifyit
iconifyit / AdobeIllustratorMenuCommands.js
Created September 6, 2021 21:56
Simple function to execute menu commands in an Adobe Illustrator JSX script.
/**
* MenuCommand object for executing Adobe Illustrator menu commands.
* @param {String} kCommandStr
* @param {Boolean} runImmediately
* @constructor
*/
function doMenuCommand(kCommandStr) {
/**
* The Command string
@iconifyit
iconifyit / rgb-to-hex.js
Created August 29, 2021 15:55
RGB-to-Hexadecimal and Hexadecimal-RGB conversion
const hexToRgb = (hex) => {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
module.exports.hexToRgb = hexToRgb;
@iconifyit
iconifyit / javascript-singleton.js
Last active August 25, 2021 02:10
Example of how to implement a Singleton pattern in JavaScript.
/*
* The instance symbol should be defined in the scope
* in which you want the singleton to exist. This does
* not necessarily mean globally. Just within your
* execution context.
*/
let instance
const Singleton = (() => {
const createInstance = () => {
@iconifyit
iconifyit / wordpress-bootstrap.sh
Created August 19, 2021 21:27
Bootstrap script for basic Wordpress install
#!/bin/bash
yum update -y
yum install httpd php php-mysql -y
cd /var/www/html
echo "healthy" > healthy.html
wget https://wordpress.org/wordpress-latest.tar.gz
tar -xzf wordpress-latest.tar.gz
cp -r wordpress/* /var/www/html/
rm -rf wordpress
rm -rf wordpress-*.tar.gz
@iconifyit
iconifyit / serverless-example.yaml
Created April 26, 2021 15:00
Example serverless file
app: aws-pdf-merge
org: iconify
service: pdf-workflow
custom: ${file(./yml/custom.yml)}
# ================================================================================================
# PROVIDER
# ================================================================================================
provider:
@iconifyit
iconifyit / javascript-singleton.js
Created April 11, 2021 19:04
JavaScript singleton implementation
/*
* The instance symbol should be defined in the scope
* in which you want the singleton to exist. This does
* not necessarily mean globally. Just within your
* outermost execution context.
*/
let instance;
const Singleton = (() => {
const createInstance = () => {
@iconifyit
iconifyit / resize-selection.jsx
Last active December 17, 2020 13:05
Adobe Illustrator Script - Resize selected items
/**
* Usage : resizeSelectedItems(getUserInput())
*
* =========
* CAUTION : This script will scale all selected items. It cannot determine if an object is simple or compound.
* ========= It is best to group compound objects made up of multiple PageItems.
*
* `getUserInput` is separated so you can easily use the main function, `resizeSelectedItems`,
* in your code. Make sure the input to `resizeSelectedItems` is a string indicating the
* new size. The options are:
@iconifyit
iconifyit / jsx-console.js
Created November 8, 2020 20:45
Allows you to send log messages to the browser's/CEPClient's console from JSX scripts in CEP panels in Adobe Illustrator. This _may_ work in other apps but has not been tested.
/*
* Usage:
*
* You can load this class either via html <script/> tag:
* <script src="path/to/jsx-console.js"></script>
*
* Or Using require:
* const jsxConsole = require('/path/to/jsx-console/jsx-console.js');
*
* Then, in your JSX code, use the console object the same as you would the browser console class.