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 / build-ruleset.scss
Last active June 20, 2019 11:35
SASS : Dynamically Build Ruleset
@mixin layout($sections, $unit:"%") {
#content {
@each $name, $rules in $sections {
.#{$name} {
@each $key, $value in $rules {
#{$key} : $value
}
}
}
}
@iconifyit
iconifyit / cep-module-example.jsx
Last active June 20, 2019 11:38
This is an example of using a module pattern and closure together to build client-side CC/CEP extension modules.
/**
* @see https://github.com/Adobe-CEP/Samples/blob/master/XmpSamplePanel/js/xmp_bridge.js
*/
/*
* ADOBE SYSTEMS INCORPORATED
* Copyright 2014 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
@iconifyit
iconifyit / site-speed-htaccess
Last active July 2, 2019 20:35
Typical Expires, Etag, and Cache-control for Google Site Speed Test best results
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
@iconifyit
iconifyit / htaccess
Last active July 19, 2019 11:33
Simple whole-site A/B test rules for htaccess
# The rules below allow you to A/B test any page on your site by splitting traffic to one of two
# sub-pages depending on the timestamp when they visit. If the millisecond is an even number,
# they are redirect to /a/ if the millisecond is odd they go to /b/. This ensures a statisticaly
# even split since the probability of the second being even or odd is about 50/50.
#
# You will need to create 3 sub-pages on your site: @, a, b so you'll end up with :
#
# https://yourdomain.com/@/any-page-name
# https://yourdomain.com/a/any-page-name
# https://yourdomain.com/b/any-page-name
#https?://(www.)?(MyDomain.com|MyInstall.wpengine.com|MyCDNcrazyness1234567890(.wpengine|-wpengine).netdna-(ssl|cdn).com)/(wp-content|wp-includes)# => https://MyCDNcrazyness1234567890-wpengine.netdna-ssl.com/$5
{
"multipass" : true,
"plugins": [
{"removeTitle": false},
{"cleanupAttrs": true},
{"inlineStyles": {"onlyMatchedOnce": false}},
{"removeDoctype": true},
{"removeXMLProcInst": true},
{"removeComments": true},
{"removeMetadata": true},
@iconifyit
iconifyit / Group-Layers-in-Adobe-Illustrator.js
Last active December 13, 2019 16:42
JSX function for Adobe Illustrator to group layers based on a matching substring in the layer names. See code comment for more details.
/**
* Group layers in Adobe Illustrator into sub-layers based on a substring
* of the layer names. For instance, given layers named with the pattern:
* 'Icon-set-01-some-keywords-here'
* Call:
* groupLayers('Icon-set-01');
*
* The result will be to create a new parent layer named 'Icon-Set-01' and
* to group any layer whose name starts with 'Icon-Set-01' under that layer.
* @param nameStem
@iconifyit
iconifyit / react-error-boundary.js
Created January 17, 2020 23:32
Example of React ErrorBoundary (by Dan Abramov)
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { error: null, errorInfo: null };
}
componentDidCatch(error, errorInfo) {
// Catch errors in any components below and re-render with error message
this.setState({
error: error,
@iconifyit
iconifyit / Enregistrer la selection en SVG.jsx
Created January 20, 2020 03:57 — forked from SebCorbin/Enregistrer la selection en SVG.jsx
Illustrator script - Save selection as SVG
/*
* Export selection to SVG - export_selection_as_SVG
* (Adapted from Layers to SVG 0.1 - export_selection_as_SVG.jsx, by Rhys van der Waerden)
*
* @author SebCorbin
*/
// Variables
var ignoreHidden = true,
svgExportOptions = (function () {
@iconifyit
iconifyit / SelectionExporter.js
Created January 20, 2020 04:10
JavaScript Extension class for exporting a selection in Illustrator as SVG.
/*
* Usage :
*
* new SelectionExporter(
* app.activeDocument.selection[0],
* '/tmp/somefolder/tempfile.ai',
* 'My File'
* );
*/