Skip to content

Instantly share code, notes, and snippets.

View jimmitchell's full-sized avatar

Jim Mitchell jimmitchell

View GitHub Profile
@jimmitchell
jimmitchell / AppleScriptPasswordGenerator.scpt
Created June 8, 2023 14:51
AppleScript to generate secure passwords.
property allowedCharacters : {33, 35, 36, 37, 38, 42, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122}
property givenPasswordLength : 21
repeat while true
try
set givenPasswordLength to text returned of (display dialog "Enter desired password length:" with title "Password Generator" default answer givenPasswordLength)
set givenPasswordLength to givenPasswordLength as integer
if givenPasswordLength is not greater than 0 then error "Please enter a valid positive integer."
exit repeat
on error errMsg
@jimmitchell
jimmitchell / Mailplane CSS for New Gmail.css
Created July 13, 2018 20:21
This is the CSS I used for the new Gmail look with Mailplane
/* Hide zero inbox message */
.TC[colspan="3"] {
display: none;
}
/* Hide message sidebar */
.Bu:not(:first-child) {
display: none;
}
/* Hide categories links in sidebar */
div.byl.aJZ.a0L,
<?php
// Change the page title separator.
// change "slug" to your theme's domain
function slug_document_title_separator( $sep ) {
$sep = ":";
return $sep;
}
add_filter( 'document_title_separator', 'slug_document_title_separator' );
<?php
// Gets the year of your first published post, the current year, and displays the year range between them.
// If both are the same year, just displays current year. Change "slug" to your theme's domain.
function slug_copyright() {
$fp_get_all = get_posts( array(
'numberposts' => 1,
'post_status' => 'publish',
'order' => 'ASC'
) );
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
// Exclude pingbacks from comment count
// change "slug" to your theme's domain
function slug_comment_count( $count ) {
global $id;
$comment_count = 0;
$comments = get_approved_comments( $id );
foreach ( $comments as $comment ) {
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Remove the silly WordPress Emoji stuff...
function mnmlst_disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
@jimmitchell
jimmitchell / Compress_Files_or_Folders.scpt
Last active June 8, 2023 14:16
AppleScript to Compress Files or Folders in the macOS Finder
-- choose files or folders to archive since AppleScript can't seem to allow both at once...
set archiveOption to button returned of (display dialog "Archive files or folders?" buttons {"Cancel", "Folders", "Files"} default button 3)
-- now let's choose what we want to archive...
if archiveOption is "Files" then
set selectedItems to choose file with prompt "Select files you want to compress:" with multiple selections allowed
else if archiveOption is "Folders" then
set selectedItems to choose folder with prompt "Select folders you want to compress:" with multiple selections allowed
else if archiveOption is "Cancel" then
return
@jimmitchell
jimmitchell / Finder_Add_Empty_Files.scpt
Last active August 29, 2015 14:12
AppleScript to Add Empty Files in Finder Quickly
property defaultFileName : "newFile.txt"
tell me to activate
set theFileName to text returned of (display dialog "Enter a file name:" default answer defaultFileName)
tell application "Finder"
activate
if the (count of windows) is not 0 then
set theFolder to (folder of the front window) as text
set theFolder to POSIX path of theFolder
else
set theFolder to POSIX path of (get path to desktop)
@jimmitchell
jimmitchell / AppleScript to Toggle the Desktop.scpt
Last active June 8, 2023 14:17
AppleScript to Toggle the Desktop
tell application "System Events"
set frontMostApp to short name of the first process whose frontmost is true
end tell
try
set theDefault to ((do shell script "defaults read com.apple.finder CreateDesktop") as integer) as boolean
on error -- if the default value doesn't already exist, create it.
do shell script "defaults write com.apple.finder CreateDesktop 1"
set theDefault to ((do shell script "defaults read com.apple.finder CreateDesktop") as integer) as boolean
end try
do shell script "defaults write com.apple.finder CreateDesktop " & (((not theDefault) as integer) as string)
@jimmitchell
jimmitchell / Minimalist-Mailplane-3-Style.css
Last active May 31, 2018 20:09
Minimalist Mailplane 3 Style
/* Hide switcher */
div.aki.pp {
visibility: hidden;
}
/* Hide compose button */
/*
div.aic {
display: none;
}