Skip to content

Instantly share code, notes, and snippets.

View firefly05's full-sized avatar

Curtis firefly05

View GitHub Profile
#!/bin/bash
#
TOTAL_POSTS=$(wp post list --post_type=recruiter_hub_pt --format=count)
echo "There are $TOTAL_POSTS posts in total";
# To perform a test, populate the TEST_POSTS array with the IDs of the
# posts you wish to run the scipt on.
# e.g. TEST_POSTS=(118802 118759 118655 118583);
/**
* Post IDs expects an array of values, or an array with a single value.
* Removing the '_elementor_edit_mode' turns elementor off. All the elementor settings
* are still saved in meta and will reapply if "Edit with elementor" is clicked again.
*
* The elementor content is stored in the _elementor_data post meta
*/
function kanopi_convert_elementor_to_classic_block( $post_ids ){
#!/bin/bash
#
# Variable ROLEMAP will hold a reference list of all the current roles
# and the values to which they should be updated
declare -A ROLEMAP;
# List of roles to be converted to the 'editor' role
ROLE_TO_EDITOR=(
academy
@mixin box-shadow($top, $left, $blur, $size, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $size $color;
-moz-box-shadow:inset $top $left $blur $size $color;
box-shadow:inset $top $left $blur $size $color;
} @else {
-webkit-box-shadow: $top $left $blur $size $color;
-moz-box-shadow: $top $left $blur $size $color;
box-shadow: $top $left $blur $size $color;
}
<?php
/**
* Wordpress hook for hiding the WP Adminbar on the front end.
* @file functions.php
*/
add_filter('show_admin_bar', '__return_false');
?>
@firefly05
firefly05 / compare today's date with written date
Created June 17, 2013 18:31
Traverse document for any element that has a due date. Then compare that date to today's date. Use the difference for whatever purpose you like. My original, color the table cells yellow if the item is due in two days or less
// get the current date
var now = new Date();
var curr_date = now.getDate();
var curr_month = now.getMonth() + 1;
var curr_year = now.getFullYear();
// format current date as it is in Redmine so we can do the math
var now = curr_month + '/' + curr_date + '/' + curr_year;
var now
console.log(now);
@firefly05
firefly05 / Skip Wordpress confirmation screen on logout
Created June 14, 2013 15:09
bypass wordpress are you sure you want to logout screen when logging out of an already logged out account
// originally by Camden Ross. Thanks
/* bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. */
function smart_logout() {
if (!is_user_logged_in()) {
$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
wp_safe_redirect( $smart_redirect_to );
exit();
} else {
check_admin_referer('log-out');
@firefly05
firefly05 / Disable wordpress admin bar
Created June 14, 2013 15:06
Disable admin bar for logged in users
// disable the admin bar for logged in users
if (!function_exists('disableAdminBar')) {
function disableAdminBar(){
remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); // for the admin page
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // for the front end
function remove_admin_bar_style_backend() { // css override for the admin page
echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
{
"cmd": [
"java",
"-jar", "${packages}/Google Closure Compiler/bin/compiler.jar",
"--js", "$file", "--js_output_file", "$file_base_name-min.js", "--compilation_level", "WHITESPACE_ONLY"
],
"windows": {
"cmd": ["${packages}/Google Closure Compiler/bin/compiler.cmd", "$file"],
"file_regex": "^(.*?):([0-9]*):",
"selector": "source.js"

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt