Skip to content

Instantly share code, notes, and snippets.

View thejoltjoker's full-sized avatar

Johannes thejoltjoker

View GitHub Profile
@wilkerlucio
wilkerlucio / grid_builder.js
Created August 6, 2013 03:29
Photoshop Grid Generator
var DocumentArea = function(doc) {
this.doc = doc;
};
DocumentArea.prototype.bounds = function() {
return [0, 0, this.doc.width, this.doc.height];
};
var DocumentArea = function(doc) {
this.doc = doc;
@tomekc
tomekc / ps-export-layers-to-png.jsx
Created June 7, 2012 22:21
Photoshop script that exports to PNG all layers and groups whose names end with ".png".
#target photoshop
// $.level = 2;
/*
* Script by Tomek Cejner (tomek (at) japko dot info)
* based on work of Damien van Holten:
* http://www.damienvanholten.com/blog/export-groups-to-files-photoshop/
*
* My version adds support of nested layer groups,
* and exports single layers in addition to groups.
@vladocar
vladocar / layerNumber.js
Created January 17, 2012 21:18
Number of Layers in Photoshop
var layerNum = app.activeDocument.layers.length;
prompt("Layers Number:", layerNum);
@vladocar
vladocar / NumberGuidesGrid.js
Created November 3, 2011 03:54
Make Guides Grid with number of guides in Photoshop CS5
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);
@seanh
seanh / formatFilename.py
Created April 11, 2009 18:30
Turn any string into a valid filename in Python.
def format_filename(s):
"""Take a string and return a valid filename constructed from the string.
Uses a whitelist approach: any characters not present in valid_chars are
removed. Also spaces are replaced with underscores.
Note: this method may produce invalid filenames such as ``, `.` or `..`
When I use this method I prepend a date string like '2009_01_15_19_46_32_'
and append a file extension like '.txt', so I avoid the potential of using
an invalid filename.