Skip to content

Instantly share code, notes, and snippets.

View Arahnoid's full-sized avatar

Igor Grinchesku Arahnoid

  • Chernivtsi, Ukraine
View GitHub Profile
@Arahnoid
Arahnoid / RGB-Hex.js
Last active December 27, 2022 21:32
[Convert color format] Bunch of RGB to Hex and Hex to RGB convert javascript functions what works well in Photoshop #Photoshop
///////////////////////////////////////////////////////////////////////////////////
/// 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
@Arahnoid
Arahnoid / emacs-image-functions.org
Last active March 12, 2022 20:01
Collection of useful emacs-lisp functions for working with images

Editing images in Markdown files

ig/md-imagemagick-add-shadow

When an image has large bits of white color it may merge with the document background. To avoid this lets add a shadow to the image. We can parse the file path from a image object in Markdown file and send it to ImageMagic.

(defun ig/md-imagemagick-add-shadow ()
  "Add shadow to a Markdown image element"
  (interactive "@*")
@Arahnoid
Arahnoid / changeColorMode.js
Last active February 11, 2022 22:34
[Change document color mode] Change color mode of document in photoshop #Photoshop
// change color mode of document in photoshop
// http://ps-scripts.com/bb/viewtopic.php?f=9&t=3158&start=0
var doc = activeDocument;
var ext= doc.name.toLowerCase().match(/[^\.]+$/);
if(doc.mode !=DocumentMode.CMYK && ext == "tif"){
doc.changeMode(ChangeMode.CMYK);
@Arahnoid
Arahnoid / config.org
Last active July 25, 2021 09:38
Diabetes.org

Capture

Variables

Define list of variables for org files used for capturing various tasks

(defvar +org-capture-books-file (concat org-directory "books.org")
  "Default, centralized target for org-capture templates.")
(defvar +org-contacts-file (concat org-directory "contacts.org")
  "Org contacts path")
(defvar +org-capture-diabetes-file (concat org-directory "diabetes.org")
  "Capture diabetes related records")
@Arahnoid
Arahnoid / toggle-emphasis.el
Last active December 18, 2020 04:44
A simple function and key binding for Doom Emacs allows to toggle on/of emphasis
(defun my-toggle-emphasis ()
"Toggle emphasis in buffer"
(interactive)
(if (eq org-hide-emphasis-markers t)
(progn
(setq org-hide-emphasis-markers nil)
(font-lock-fontify-buffer)
(message "Emphasis toggled OFF"))
(progn
Debugger entered--Lisp error: (wrong-number-of-arguments quote 3)
(quote (org-mode-map) quote (org-journal-search-mode-map))
(general-define-key :states (quote (normal visual motion emacs insert)) :major-modes t :prefix doom-localleader-key :non-normal-prefix doom-localleader-alt-key :keymaps (quote (org-mode-map) quote (org-journal-search-mode-map)) "n" (function org-journal-search-next) "p" (function org-journal-search-prev))
(progn (general-define-key :states (quote (normal visual motion emacs insert)) :major-modes t :prefix doom-localleader-key :non-normal-prefix doom-localleader-alt-key :keymaps (quote (org-mode-map) quote (org-journal-search-mode-map)) "n" (function org-journal-search-next) "p" (function org-journal-search-prev)) (general-define-key :states (quote (normal visual motion emacs insert)) :major-modes t :prefix doom-localleader-key :non-normal-prefix doom-localleader-alt-key :keymaps (quote (org-mode-map) quote (org-journal-mode-map)) "n" (function org-journal-open-next-entry) "p" (fun
@Arahnoid
Arahnoid / ColorConvertFunctions.ms
Last active April 21, 2019 23:23
3D Max Color convert functions #3dmax
/**
* 3D Max
* COLOR CONVERT FUNCTIONS
* Source: http://www.emoticode.net/maxscript/color-convert-functions.html
*/
--CONVERT RGB (0-255) TO HEXSTRING
fn RGBtoHEX clrRGB = (bit.intAsHex clrRGB.r)+(bit.intAsHex clrRGB.g)+(bit.intAsHex clrRGB.b)
RGBtoHEX (color 80 170 178)
-->"50aab2"
@Arahnoid
Arahnoid / Photoshop Debug Fn.js
Last active April 21, 2019 23:21
[Debug Photoshop Fn] #Photoshop
// 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()
@Arahnoid
Arahnoid / layersOrder.js
Last active April 21, 2019 23:20 — forked from vladocar/layersOrder.js
[Sort A-Z] Sort Photoshop layers alphabeticaly #Photoshop
function sortLayerAZ (layerList) {
var layers;
// check if layer list is provided
if (layerList) {
layers = layerList;
} else {
layers = activeDocument.layers;
}
var len = layers.length;
@Arahnoid
Arahnoid / ps-export-layers-to-png.jsx
Last active April 21, 2019 23:20 — forked from tomekc/ps-export-layers-to-png.jsx
[Export .png layers] Photoshop script that exports to PNG all layers and groups whose names end with ".png". #Photoshop
#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.