Skip to content

Instantly share code, notes, and snippets.

@kokaruk
kokaruk / group-by-reducer.js
Last active February 14, 2022 04:11
group by
const groupCourtsByState = (): {} => {
return data.reduce((r, a) => {
r[a.state] = [...(r[a.state] || []), a];
return r;
}, {});
};
@kokaruk
kokaruk / docker-cheat-sheat.md
Created October 14, 2020 12:47 — forked from andredurao/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

System.out.println("\033[0m BLACK");
System.out.println("\033[31m RED");
System.out.println("\033[32m GREEN");
System.out.println("\033[33m YELLOW");
System.out.println("\033[34m BLUE");
System.out.println("\033[35m MAGENTA");
System.out.println("\033[36m CYAN");
System.out.println("\033[37m WHITE");
@kokaruk
kokaruk / acrobat_field_tab.js
Last active August 18, 2022 16:41
Auto tab to next form field in Acrobat Forms
// Document-level function
function nextTab(fieldName)
{
if (event.willCommit || event.fieldFull) this.getField(fieldName).setFocus();
}
//Keystroke script of a text field:
// Autotab to the "text2" field
nextTab("text2");
tell application "Finder"
set sourceFile to choose file with prompt "Please select directory."
display dialog "Input times" default answer "" buttons {"OK"} default button 1
set theAnswer to (text returned of result)
repeat with i from 1 to theAnswer
duplicate file sourceFile
end repeat
end tell
@kokaruk
kokaruk / mountDrive.applescript
Created November 29, 2017 12:20
Mount Network Drive
set MyShare to "MyShare"
set OpenShare to "OpenShare"
tell application "System Events" to set diskNames to name of every disk
set myDisks to {MyShare, OpenShare}
repeat with myVolume in myDisks
try
if myVolume is in diskNames then
set clipdata to get the clipboard as text
set the clipboard to my change_case(the clipdata, "upper")
on change_case(this_text, this_case)
if this_case is "lower" then
set the new_text to do shell script "echo " & quoted form of (this_text) & " | tr A-Z a-z"
else
set the new_text to do shell script "echo " & quoted form of (this_text) & " | tr a-z A-Z"
end if