Skip to content

Instantly share code, notes, and snippets.

View codingChewie's full-sized avatar
💭
(╯'□')╯︵ ┻━┻

Chewie codingChewie

💭
(╯'□')╯︵ ┻━┻
View GitHub Profile
@codingChewie
codingChewie / rgb_to_hex_to_rgb.php
Created May 30, 2016 17:43 — forked from Pushplaybang/rgb_to_hex_to_rgb.php
php functions convert hex to rgb and rgb to hex
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEDIT REGULAR EXPRESSION GUIDE MODIFIED 2013-03-27 : 13:08
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE (Perl Compatible Regular Expressions) engine is what BBEdit uses.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@codingChewie
codingChewie / wp_query-arguments.php
Created December 15, 2016 16:58
Arguments that can be used with WP_Query( $args )
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@codingChewie
codingChewie / zip-to-folder.scpt
Last active March 26, 2021 16:42
AppleScript that takes a zip archive or other type set with the fileExt variable and moves it to a directory with the same name as the file.
(*
Date: 16-12-15
Developer: codingChewie
Purpose: Takes archives and creates folder archive and moves files into it.
Version: 1.0
Name: zip-to-folder.scpt
Site: http://programmingmonkeys.com/
*)
on displayMessage(theMessage, scriptTitle)
@codingChewie
codingChewie / no-whitespace-files.scpt
Last active March 26, 2021 16:27
AppleScript that will replace whitespace with underscores in a file's name within a given directory
(*
Date: 16-12-14
Developer: codingChewie
Purpose: Takes filenames with whitespace and replaces with underscore in a directory
Version: 1.0
Name: no-whitespace-files.scpt
Site: http://programmingmonkeys.com/
*)
on no_whitespace(theFolder, scriptTitle)
@codingChewie
codingChewie / json-unminify.scpt
Last active March 26, 2021 16:23
AppleScript to unminify JSON into a new JSON file
(*
Date: 16-10-21
Developer: codingChewie
Purpose: Takes a minified JSON file and un-minifies it
Version: 1.0
Name: json-unminify.scpt
Site: http://programmingmonkeys.com/
*)
tell application "Finder"
@codingChewie
codingChewie / menu-bar-folder-path.scpt
Last active March 26, 2021 16:22
AppleScript to be placed in Mac's menu bar Script folder and when ran it will prompt for folder and return the path
(*
Date: 16-10-14
Developer: codingChewie
Purpose: Get the current folder path and return it to a dialog
Version: 1.0
Name: menu-bar-folder-path.scpt
Site: http://programmingmonkeys.com
*)
try
@codingChewie
codingChewie / image-profile.scpt
Last active March 24, 2021 16:38
AppleScript that helps identify a color's profile with Macs built in SIPs
(*
Date: 16-12-21
Developer: codingChewie
Purpose: Color Labels images to help identify the color profile.
Version: 1.1
Name: image-profile.scpt
Blog: https://programmingmonkeys.com/
*)
property dialogTitle : "Image Profiler"
@codingChewie
codingChewie / tif-to-jpg.sh
Last active March 24, 2021 16:54
Shell script that takes TIF images and converts them to JPGs
# Date: 16-02-09
# Developer: codingChewie
# Purpose: Convert TIF images to JPG and move TIFs into a directory
# Version: 1.0
# Name: tif-to-jpg.sh
# Site: http://programmingmonkeys.com/
WORKING=""
TIFFOLDER="tif"
@codingChewie
codingChewie / find_replace
Created March 23, 2017 20:05
AppleScript to find and replace
-- Find and replace a single word in an opened BBEdit document
tell application "BBEdit"
make new document
-- Add some text to the document
set text of front document to "Bacon Ipsum"
-- Find and replace
set every word of front document where it = "Bacon" to "Steak"
end tell