Skip to content

Instantly share code, notes, and snippets.

View NimaiMalle's full-sized avatar

Nimai Malle NimaiMalle

View GitHub Profile
@NimaiMalle
NimaiMalle / SortLayers.js
Created May 25, 2020 22:11
Sort selected layers in Photoshop by layer name
var idx_shift = 0
try {
activeDocument.backgroundLayer
} catch (e) {
idx_shift = 1
}
var list = get_selected_layers()
if (list) {
var orig_idx = list.slice()
function cmp(a, b) {
// ==UserScript==
// @name GitHub Ignore Whitespace
// @namespace http://spicewood.tech/
// @version 1.1
// @description Add URL parameter to ignore whitespace in GitHub pull request reviews
// @author Nimai C. Malle
// @match https://github.com/*/*/pull/*
// @grant none
// @downloadURL https://gist.githubusercontent.com/NimaiMalle/9f1ddac7784632ba1b9b72f753dbcdf4/raw/github_ignore_whitespace.js?v=1.1
// ==/UserScript==
@NimaiMalle
NimaiMalle / ImageButton.ts
Created December 1, 2018 13:05
Phaser 3 Image Button supporting click and auto-repeat
class ImageButton extends Phaser.GameObjects.Image {
constructor(scene: Phaser.Scene, x: number, y: number, texture: string, frame?: string | integer) {
super(scene, x, y, texture, frame)
this.setInteractive()
scene.add.existing(this)
this.on('pointerdown', () => {
this._onDown && this._onDown()
this._onPress && this._onPress()
this._clickTimer = window.setTimeout(() => {
this._clickInterval = window.setInterval(() => this._onPress && this._onPress(), this.repeat)
@NimaiMalle
NimaiMalle / Lenticular.jsx
Last active January 14, 2022 00:03
Photoshop Script to interleave layers for use with Lenticular Lens Sheets.
#target Photoshop
function makeLayerMask(maskType) {
if( maskType == undefined) maskType = 'RvlS' ; //from selection
//requires a selection 'RvlS' complete mask 'RvlA' otherThanSelection 'HdSl'
var desc140 = new ActionDescriptor();
desc140.putClass( charIDToTypeID('Nw '), charIDToTypeID('Chnl') );
var ref51 = new ActionReference();
ref51.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk ') );
desc140.putReference( charIDToTypeID('At '), ref51 );
desc140.putEnumerated( charIDToTypeID('Usng'), charIDToTypeID('UsrM'), charIDToTypeID(maskType) );
@NimaiMalle
NimaiMalle / SaveAsJpg.jsx
Created June 26, 2018 03:52
Save without dialog prompts in Photoshop
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 11;
var Name = decodeURI(activeDocument.name).replace(/\.[^\.]+$/, '');
var Path = decodeURI(activeDocument.path);
var saveFile = File(Path + "/" + Name + ".jpg")
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
@NimaiMalle
NimaiMalle / AddFileName20pt.jsx
Created June 26, 2018 03:50
Add filename as text in a Photoshop document
// this script is a variation of the script addTimeStamp.js that is installed with PH7
if ( documents.length > 0 )
{
var originalDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.ERROR;
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
try