Skip to content

Instantly share code, notes, and snippets.

View BobbyRuby's full-sized avatar

Bobby Ruby BobbyRuby

View GitHub Profile
@BobbyRuby
BobbyRuby / Match File Upload Directiory Wordpress - Get file name
Created May 6, 2020 05:42
Using $handle['url] returned by wp_handle_upload
$name = preg_replace("/".preg_quote($install_url, "/")."wp-content\/uploads\/[0-9]+\/[0-9]+\//", '', $file_url );
jQuery(this).find('option:not(:selected)').each(function (i) {
// Check for a number input with an id of this task type id
let exists = jQuery('input[id="'+ jQuery(this).val() +'"]');
// Does exist
if ( exists.length !== 0){
// Remove it
jQuery(exists).parent().remove();
}
});
@BobbyRuby
BobbyRuby / jQuery.post
Last active April 28, 2020 02:12
Usage Example
var get_client_projects = jQuery.post(dir + "/wp-content/plugins/rvms/class_RvmsHandleJSPostRequests.php",
{
requested: 'get_client_projects', client_id: selected_client_id
},
function (data) {
}, 'json');
get_client_projects.done(function (data) { // success
var select_option_arrays = processData(data, selected_client_id);
projects_managed.html(select_option_arrays[0]); // add options
projects_associated.html(select_option_arrays[0]); // add options
package com.example.poleprofilingapp.project;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
<?php
/**
* Created by PhpStorm.
* User: Bobby
* Date: 11/26/14
* Time: 1:30 PM
* Channel Log:
* @ V 1.0.0 - 11/26/14
*/
/**
/**
* Produces Task Boxes Saved at the time a task was created.
*/
private function _task_create_task_meta_boxes()
{
$task_boxes = array();
if (isset($this->_post->ID)) {
$task_boxes = get_post_meta($this->_post->ID, Rvms_core_Plugin::PLUGIN_PREFIX . 'task_' . 'boxes', TRUE);
// There are task boxes
/*
@TODO Needs Refactored to reduce code smell and optimize jquery
@TODO Some JS adds classes that should really be added by the markup
*/
function updateBoxFieldsOnDrop(field_wrap) {
let bn = parseInt(jQuery(field_wrap).attr('id').replace(/form_box_field_wrap-form_box_/, ''));
jQuery('.edit-form-container-outer label')
.filter(function () {
// Get all labels for this field
let regExp = new RegExp('form_box_' + bn + '-[a-z_]+[0-9]+');
/**
* @param $post_ID
*/
public static function task_type_save_custom_field_builder( $post_ID ) {
$boxes_arr = [];
// Loop through the post keys
foreach ( $_POST as $pk => $d ) {
// Find a field
if ( stripos( $pk, '-fields-' ) ) {
// Get form box number
@BobbyRuby
BobbyRuby / rpm_export
Created November 2, 2019 16:22
export to csv
<?php
/**
* Created by PhpStorm.
* User: Bobby
* Date: 2/27/14
* Time: 11:06 AM
*/
/**
* @param $export_items
* @param $table
http://regex101.com/r/wW7dV3/1