Skip to content

Instantly share code, notes, and snippets.

View jalbertbowden's full-sized avatar

albert jalbertbowden

View GitHub Profile
@jalbertbowden
jalbertbowden / toggleLayerType.js
Created February 17, 2019 05:03 — forked from Arahnoid/toggleLayerType.js
Toggle visiblity of a certain kind of layer in photoshop
// Install by saving to PHOTOSHOP_DIRECTORY/Presets/Scripts
// Also works just by opening it with File->Open..
// Once installed, you can add an action to run it with a keyboard shortcut
// Open Actions window (Window->Actions)
// Click the "Create a New Action" Button (dog-eared paper icon)
// Choose the name of the action and the shortcut keys you want
// Click Record
// Select Insert Menu Item...
// Select File->Scripts->toggleLayerType
@jalbertbowden
jalbertbowden / toggleHueSatLayers.js
Created February 17, 2019 05:03 — forked from Arahnoid/toggleHueSatLayers.js
Toggle the hue and saturation adjustment layers in photoshop
#target photoshop
var currentDoc = app.activeDocument;
for ( var i = 0; i < currentDoc.layers.length; i++ ) {
var layer = currentDoc.layers[i];
if( layer.kind === LayerKind.HUESATURATION )
{
layer.visible = layer.visible ? false : true;
}
@jalbertbowden
jalbertbowden / PhotoshopSpriteStripMaker.js
Created February 17, 2019 05:03 — forked from Arahnoid/PhotoshopSpriteStripMaker.js
Photoshop script for making a sprite sheet out of a folder of images.
/* FUNCS */
function move(l,x,y) {
var Position = l.bounds;
Position[0] = x - Position[0];
Position[1] = y - Position[1];
l.translate(-Position[0],-Position[1]);
}
@jalbertbowden
jalbertbowden / PhotoshopSockets.js
Created February 17, 2019 05:01
A simple server that can be run inside photoshop, demonstrating how to respond to socket calls
// requires photoshop CS5+
// create a new socket
conn = new Socket();
var keep_serving = true;
// sample functions. In a real application you'd have handler functions that could accept more complex inputs
var alrt = alert; // pop a dialog
var newLayer = function () { return app.activeDocument.artLayers.add(); }; // make a layer
var stop = function () { keep_serving = false; }; // stop the server
@jalbertbowden
jalbertbowden / psd2png.js
Created February 17, 2019 04:59 — forked from Arahnoid/psd2png.js
Dead simple javascript, providing a basic Photoshop action for exporting PSD files as PNG. Just launch it on your desktop. I think, this one is Windows only.
#target "photoshop"
var outputWidth = 1024;
var inputFolder = Folder.selectDialog("Input folder");
var outputFolder = Folder.selectDialog("Output folder");
if (inputFolder != null && outputFolder != null) {
var files = inputFolder.getFiles("*.psd");
for (var i = 0; i < files.length; i++) {
@jalbertbowden
jalbertbowden / MultiExporter.jsx
Created February 17, 2019 04:59 — forked from TomByrne/MultiExporter.jsx
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@jalbertbowden
jalbertbowden / ChangeColor.jsx
Created February 17, 2019 04:59 — forked from Arahnoid/ChangeColor.jsx
Photoshop script to update the colour of all shape and fill layers that are the same colour as the currently selected layer. Uses the foreground colour as the new colour. Tested in CS4
// ChangeColor.jsx
//
// This photoshop script finds all shape and solid fill layers that match the color
// of the currently selected shape/fill layer and changes their color to the
// foreground color.
//
// Tested on Adobe Photoshop CS4 (Mac)
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
@jalbertbowden
jalbertbowden / read-write-file.js
Created February 17, 2019 04:52
Read Write to file with javascript
/// write to file
var txtFile = "c:/test.txt";
var file = new File(txtFile);
var str = "My string of text";
file.open("w"); // open file with write access
file.writeln("First line of text");
file.writeln("Second line of text " + str);
file.write(str);
file.close();
@jalbertbowden
jalbertbowden / empty-wp-plugin.php
Created February 14, 2019 17:32 — forked from sareiodata/empty-wp-plugin.php
Empty WordPress plugin
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
@jalbertbowden
jalbertbowden / .htaccess
Created January 22, 2019 03:34 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/