This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
access_token:="" ;Your Github access token goes here if you want to publish it to your Gist list | |
info:="Code to post goes here" ;Change this to create the new text for the Gist | |
filename:="mygit.txt" ;change this to whatever you want your file name to be | |
desc:="my description" ;This is where you would have a description for your Gist | |
post_gist(info,access_token,filename,desc) | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* makeLayerActiveByName | |
* @param string nm Layer name] | |
* @return | |
* @usage selects layer by name and mak it active | |
* @env Photoshop | |
*/ | |
function makeLayerActiveByName(nm) { | |
function cTID(s) { return app.charIDToTypeID(s); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////////////////////// | |
/// Colection of RGB to HSB, HSB to RGB convert functions | |
/// Source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb | |
/////////////////////////////////////////////////////////////////////////////////// | |
/** | |
* componentToHex convert two digit htx value to R, G or B chanel value | |
* @param number c value from 0 to 225 | |
* @return string value of R, G or B chanel | |
* @usage //alert (componentToHex(255)); //ff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A helper function for debugging in Photoshop | |
// It also helps the user see what is going on | |
// if you turn it off for this example you | |
// get a flashing cursor for a number time | |
function WaitForRedraw() { | |
var eventWait = charIDToTypeID("Wait") | |
var enumRedrawComplete = charIDToTypeID("RdCm") | |
var typeState = charIDToTypeID("Stte") | |
var keyState = charIDToTypeID("Stte") | |
var desc = new ActionDescriptor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = app.activeDocument; | |
var guides = app.activeDocument.guides; | |
var w = doc.width; | |
var h = doc.height; | |
function MakeGuidesGrid(numVerticalGuides, gutterVertical, numHorisontalGuides, gutterHorisontal) { | |
if (numHorisontalGuides !== 0) { | |
var j = h / numHorisontalGuides; | |
for (var i = 0; i < numHorisontalGuides; i++) { | |
guides.add(Direction.HORIZONTAL, j * i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = app.activeDocument; | |
var guides = app.activeDocument.guides; | |
var w = doc.width; | |
var h = doc.height; | |
function MakeGuidesGrid(unitVertical, gutterVertical, unitHorisontal, gutterHorisontal) { | |
if (unitHorisontal !== 0) { | |
var j = h / unitHorisontal; | |
for (var i = 0; i < j; i++) { | |
guides.add(Direction.HORIZONTAL, i * unitHorisontal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sortLayerAZ (layerList) { | |
var layers; | |
// check if layer list is provided | |
if (layerList) { | |
layers = layerList; | |
} else { | |
layers = activeDocument.layers; | |
} | |
var len = layers.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var layerNum = app.activeDocument.layers.length; | |
var arr = []; | |
for (var i = 0; i < layerNum; i++) { | |
arr[i] = '"'+app.activeDocument.layers[i].name+'"'; | |
} | |
// taken from: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array | |
var sorted_arr = arr.sort(); // You can define the comparing function here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var layerNum = app.activeDocument.layers.length; | |
var a = []; | |
for (var i = 0; i < layerNum; i++) { | |
a[i] = '"' + app.activeDocument.layers[i].name + '"'; | |
} | |
prompt("Layers Names:", a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var layerNum = app.activeDocument.layers.length; | |
prompt("Layers Number:", layerNum); |
OlderNewer