From 1747441b6da1b06f0ca371c7541b50874fb6399b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Wed, 5 Dec 2018 14:50:39 -0800 Subject: [PATCH 1/4] Expression for centering the anchor point on text layers. --- jsx/EXP_centerTextLayerAnchor.jsx | 1 + 1 file changed, 1 insertion(+) create mode 100644 jsx/EXP_centerTextLayerAnchor.jsx diff --git a/jsx/EXP_centerTextLayerAnchor.jsx b/jsx/EXP_centerTextLayerAnchor.jsx new file mode 100644 index 0000000..353c059 --- /dev/null +++ b/jsx/EXP_centerTextLayerAnchor.jsx @@ -0,0 +1 @@ +/* 0 center | 1 right | 2 left | 3 top | 4 bottom | 5 top right | 6 top left | 7 bottom right | 8 bottom left */ function centerTextLayerAnchor( n ){ rect = thisLayer.sourceRectAtTime(); t = rect.top; h = rect.height x = rect.left + (rect.width/2); y = (t-( t-h)+(t*2))/2; switch (n){ rect = thisLayer.sourceRectAtTime(2); case 0 : offset = [0,0]; break; case 1 : offset = [ rect.width/2 , 0 , 0]; break; case 2 : offset = [ -rect.width/2 , 0 , 0]; break; case 3 : offset = [0 , -rect.height/2 , 0]; break; case 4 : offset = [0 , rect.height/2 , 0]; break; case 5 : offset = [ rect.width/2 , -rect.height/2 , 0]; break; case 6 : offset = [ -rect.width/2 , -rect.height/2 , 0]; break; case 7 : offset = [ rect.width/2 , rect.height/2 , 0]; break; case 8 : offset = [ -rect.width/2 , rect.height/2 , 0]; break; } newAnchor = [ x , y ] + offset; return newAnchor } centerTextLayerAnchor(0) \ No newline at end of file From 080007d49faf9f6a1ef3dc7bf65a53bf689a5309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 13 Dec 2018 10:16:24 -0800 Subject: [PATCH 2/4] Added script for mirroring an entire folderstructure with empty files. --- bash/ghostmirror.sh | 1 + 1 file changed, 1 insertion(+) create mode 100755 bash/ghostmirror.sh diff --git a/bash/ghostmirror.sh b/bash/ghostmirror.sh new file mode 100755 index 0000000..c7bc168 --- /dev/null +++ b/bash/ghostmirror.sh @@ -0,0 +1 @@ +find $1/ -type d -exec mkdir -p $2/{} \; -o -type f -exec touch $2/{} \;; From ced0980d234e5a0a73c32324ed0114b44530f32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 13 Dec 2018 10:38:32 -0800 Subject: [PATCH 3/4] wraped the variables in quotes in cases there are any spaces in thepath name. --- bash/ghostmirror.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ghostmirror.sh b/bash/ghostmirror.sh index c7bc168..ee64c37 100755 --- a/bash/ghostmirror.sh +++ b/bash/ghostmirror.sh @@ -1 +1 @@ -find $1/ -type d -exec mkdir -p $2/{} \; -o -type f -exec touch $2/{} \;; +find "$1"/ -type d -exec mkdir -p "$2"/{} \; -o -type f -exec touch "$2"/{} \;; From b9827360457a00243c62e27e55be8053cc9cd5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 13 Dec 2018 10:49:51 -0800 Subject: [PATCH 4/4] Handle the paths in a way theat the resulting directory is relative to the last directory in the path instead of using the full path. --- bash/ghostmirror.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bash/ghostmirror.sh b/bash/ghostmirror.sh index ee64c37..e4bfd93 100755 --- a/bash/ghostmirror.sh +++ b/bash/ghostmirror.sh @@ -1 +1,5 @@ -find "$1"/ -type d -exec mkdir -p "$2"/{} \; -o -type f -exec touch "$2"/{} \;; +orig_dir=$(pwd) +path=$(dirname $1) +dirname=$(basename $1) +cd $path; +find "$dirname"/ -type d -exec mkdir -p "$2"/{} \; -o -type f -exec touch "$2"/{} \;;