Skip to content

Instantly share code, notes, and snippets.

View corypina's full-sized avatar

Cory Piña corypina

View GitHub Profile
@corypina
corypina / move-file-to-desktop.applescript
Last active October 7, 2015 07:58
Copy specific file to desktop for attaching to email. I use it for documents I reference or email often.
-- Replace with the file you want to copy
set theFile to "Macintosh HD:Users:path:to:your:file.txt"
-- Replace with the target folder. Or just swap your username in to use the Desktop.
set theDestination to "Macintosh HD:Users:USERNAME:Desktop"
tell application "Finder" to duplicate theFile to theDestination
@corypina
corypina / set-window-bounds.applescript
Last active August 31, 2023 18:54
Resize front window to specific size.
tell application "System Events"
set frontmostApplication to name of the first process whose frontmost is true
end tell
-- The bounds are the top-left and bottom-right coordinates on your screen, eg. {x, y, x, y}
tell application frontmostApplication
set bounds of the first window to {15, 38, 1760, 995}
end tell
@corypina
corypina / JounralEntry.applescript
Last active December 19, 2015 17:49
Creates and opens timestamped text file into predetermined folder to be used for any kind of journaling. Example: "2013.07.14.800.txt" with first line reading "July 14, 2013 8:00 AM."
-- Set path to your folder here, including trailing slash and quotes.
set pathtofolder to "~/Dropbox/Write/"
-- Set preferred text editor here, including quotes.
-- Works with TextEdit, TextMate, TextWrangler, and I assume most others.
set myEditor to "Textmate"
-- Assigns bash script to variablle `ss`.
@corypina
corypina / better-popular.php
Last active December 30, 2015 22:49
A Popular Topics query for bbPress. The built in widget will show either 1) recent topics, or 2) topics with the most replies. This queries topics with a minimum number of replies, whose most recent activity ("freshness") is more recent than a variable date (e.g., "1 month ago").
@corypina
corypina / remove-empty-p.php
Last active August 29, 2015 14:26
Wordpress shortcodes will sometimes output empty <p> tags. This plugin will remove them. Source of original code: https://thomasgriffin.io/remove-empty-paragraph-tags-shortcodes-wordpress/
<?php
/*
Plugin Name: Shortcode P-Fixer
Description: Remove empty paragraphs from shortcode output.
*/
/* Original Code from Thomas Griffin
/* https://thomasgriffin.io/remove-empty-paragraph-tags-shortcodes-wordpress/
*/
@corypina
corypina / 0_reuse_code.js
Created December 18, 2015 17:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@corypina
corypina / buddypress_field_uneditable.php
Created June 18, 2018 18:21
Make a BuddyPress profile field un-editable. Requires the ID of the profile field(s)
<?php
function cp_makeProfileFieldUneditable( $retval ) {
if( is_user_logged_in() && bp_is_profile_edit() ) {
$retval['exclude_fields'] = '1'; // field id's
}
return $retval;
}
add_filter( 'bp_after_has_profile_parse_args', 'cp_makeProfileFieldUneditable' );
@corypina
corypina / wpml-beaver-build-custom-modules.php
Last active June 20, 2018 21:55
Register fields of custom BB modules into the WPML String Translation interface in WordPress. Add to functions.php, or custom module plugin.
<?php
// Translating custom Beaver Builder Modules with WPML
// Runs a filter included in the WPML String Translation plugin
add_filter( 'wpml_beaver_builder_modules_to_translate', 'wpml_modules_to_translate_filter' );
// Add each custom module to the $modules array, e.g. `custom-module-1`
function wpml_modules_to_translate_filter( $modules ) {
// Adding the first module.
@corypina
corypina / bb-custom-fonts.php
Created September 19, 2018 15:50
Register custom fonts into the Customizer and Page Builder interfaces in Beaver Builder
<?php
/**
* Customizer Custom Fonts
*
* Add fonts to the BB Theme Customizer and BB Page Builder
* Fonts will be listed under "System" fonts in the drop downs
*
* Solution originally found here:
* https://www.warpconduit.net/2016/02/15/adding-custom-fonts-to-the-beaver-builder-child-theme-customizer/
@corypina
corypina / custom-admin-css.php
Created September 20, 2018 17:48
Run custom CSS in WordPress admin screens
<?php
/**
* Add CSS to Events Admin pages
*/
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
// Get current screen if targeting post type is necessary