Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Scott Lewis iconifyit

🏠
Working from home
View GitHub Profile
@iconifyit
iconifyit / authorize-plugin.sh
Created Aug 12, 2022
Authorize un-signed Adobe Illustrator plugin
View authorize-plugin.sh
# 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 Jan 18, 2022
Script to download files from AWS S3 to a specified location.
View download-from-s3.sh
#!/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 Sep 6, 2021
Simple function to execute menu commands in an Adobe Illustrator JSX script.
View AdobeIllustratorMenuCommands.js
/**
* 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 Aug 29, 2021
RGB-to-Hexadecimal and Hexadecimal-RGB conversion
View rgb-to-hex.js
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 Aug 25, 2021
Example of how to implement a Singleton pattern in JavaScript.
View javascript-singleton.js
/*
* 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 Aug 19, 2021
Bootstrap script for basic Wordpress install
View wordpress-bootstrap.sh
#!/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
View serverless-example.yaml
app: aws-pdf-merge
org: iconify
service: pdf-workflow
custom: ${file(./yml/custom.yml)}
# ================================================================================================
# PROVIDER
# ================================================================================================
provider:
@iconifyit
iconifyit / javascript-singleton.js
Created Apr 11, 2021
JavaScript singleton implementation
View javascript-singleton.js
/*
* 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 Dec 17, 2020
Adobe Illustrator Script - Resize selected items
View resize-selection.jsx
/**
* 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 Nov 8, 2020
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.
View jsx-console.js
/*
* 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.