Skip to content

Instantly share code, notes, and snippets.

Jude Rosario JudeRosario

Block or report user

Report or block JudeRosario

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JudeRosario
JudeRosario / custom.js
Last active Aug 19, 2019
Private - Custom code for Healthjobs.ch
View custom.js
jQuery(document).ready(function($){
if (window.location.href.indexOf("unternehmens-profil") > -1) {
$('.upme-fire-editor-view').trigger('click');
$('.upme-profile-edit-bar').hide();
$('.gt3-page-title.gt3-page-title__dashboard').hide();
$('#billing_email-1, #billing_email-2-1').on('blur', function(){
if($.trim($('#billing_email-1').val()) !== $.trim($('#billing_email-2-1').val())) {
$('#billing_email-1, #billing_email-2-1').addClass('error');
$('#billing_email-1').after('<div id="upme-match-email-msg" class="upme-input-text-inline-error" ><i id="upme-reg-email-img" original-title="Invalid" class="upme-icon upme-icon-remove upme-input-text-font-cancel" ></i>' + 'Email addresses should match' + '</div>');
@JudeRosario
JudeRosario / custom-fixes.php
Created Jun 22, 2019
Product Data Tabs Fix
View custom-fixes.php
/**
* Remove broken product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
@JudeRosario
JudeRosario / gist.js
Created Jun 4, 2019
Private jQuery W3 Tag fixes
View gist.js
jQuery(document).ready(function($){
$.fn.renameTag = function(replaceWithTag){
this.each(function(){
var outerHtml = this.outerHTML;
var tagName = $(this).prop("tagName");
var regexStart = new RegExp("^<"+tagName,"i");
var regexEnd = new RegExp("</"+tagName+">$","i")
outerHtml = outerHtml.replace(regexStart,"<"+replaceWithTag)
outerHtml = outerHtml.replace(regexEnd,"</"+replaceWithTag+">");
$(this).replaceWith(outerHtml);
View keyy-custom.css
.keyy-login-wrapper .keyy-switch-label,
form#loginform {
border-color: #E91E63;
}
.keyy-wave rect.anim {
fill:#E91E63;
}
img.keyy-login-logo {
@JudeRosario
JudeRosario / keyy-woo-emails.php
Last active Mar 5, 2019
Send Keyy code on Woo signups
View keyy-woo-emails.php
<?php
add_action('user_register', 'keyy_auto_send_qr_on_signup', 10, 1);
function keyy_auto_send_qr_on_signup($user) {
$keyy = Keyy_Login_Plugin_Premium();
$user_obj = get_user_by('id', $user);
$keyy->user_send_connection_code($user_obj, 30);
}
@JudeRosario
JudeRosario / jetpack.php
Last active Jun 18, 2018
Jetpack + Keyy
View jetpack.php
<?php
/*
Plugin Name: Keyy compat fix for Jetpack
*/
add_action('plugins_loaded', 'keyy_compat');
function keyy_compat() {
if ( is_multisite() && ! is_main_site() ) {
switch_to_blog( $this->get_main_blog_id() );
View sample.php
class PRELOAD_FULLPAGE_CACHE
{
function __construct() {
add_action( 'wp_insert_post', array( $this, 'preload_desktop' ), 900, 3 ); // let's fetch the post very late
add_action( 'wp_insert_post', array( $this, 'preload_mobile' ), 990, 3 ); // let's fetch mobile version even later
add_action( 'wp_insert_post', array( $this, 'preload_amp' ), 999, 3 ); // let's fetch AMP version at last; only works on posts
}
// verison to fetch: desktop
// user-agent: Chrome 62 on a macOS Sierra 10.12.6
View gist:4da1a4460caf27024724c5250413c4b3
<?php
class Staged_Sleep_Task extends Updraft_Task_1_0 {
public function initialise() {
$sleep_for = $this->get_random_time_intervals();
$this->update_option('sleep_for', $sleep_for);
}
public function run() {
View gist:14a6eefedf7e78a6bc176c8ea7d42012
$trie = new Trie();
$start = microtime(true);
for ( $i = 0 ; $i < 20000000 ; $i++ ) {
$sid = bin2hex(openssl_random_pseudo_bytes(8));
$collision = $trie->search($sid) ;
if ( is_null($collision) ) {
$trie->add($sid, 1);
} else {
echo "\n" ."Collision with previous Hash" ."\n" ;
}
View gist:c87a3a982b0cdaa2baa8c58330950d20
<?php
$j = 0;
$start = microtime(true);
for ( $i = 0 ; $i < PHP_INT_MAX ; $i++ ) {
$j++;
}
echo $j . "\n" ;
$time_elapsed_secs = microtime(true) - $start;
You can’t perform that action at this time.