Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
robertuniqid / code.php
Created April 14, 2021 11:53
WordPress Deepl Locale -> Lang Map
<?php
if( !function_exists( 'wp_get_available_translations') )
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
$deepl = [
"BG", "CS", "DA", "DE", "EL", "ES", "ET", "FI", "FR", "HU",
"IT", "JA", "LT", "LV", "NL", "PL", "RO", "RU", "SK", "SL", "SV", "ZH",
"EN-GB", "EN-US",
"PT-PT", "PT-BR"
@robertuniqid
robertuniqid / index.html
Created September 27, 2020 21:23
Element to Zencoding
<html>
<head>
<title>Element to Zen</title>
<meta charset="UTF-8">
<script>
function element_to_zen( element ) {
let response_map = [],
_default_mapping = {
priority : 5,
parse : function( nodeName, nodeValue ) {
@robertuniqid
robertuniqid / example.js
Created August 24, 2020 21:42
eLearnCommerce - Sample Color Generator
let words = ' yes\n' +
' no\n' +
' maybe\n' +
' false\n' +
' true\n';
words = words.split( "\n" );
let c = {};
### Keybase proof
I hereby claim:
* I am rusuandreirobert on github.
* I am rusuandreirobert (https://keybase.io/rusuandreirobert) on keybase.
* I have a public key ASB0B8oUc5Wo7IxP73klokMNwXWLHZVYFq109NMFhu9Mrgo
To claim this, I am signing this object:
@robertuniqid
robertuniqid / json.json
Created July 24, 2020 08:42
Zoom Timezone List JSON
{
"Pacific/Midway" : "Midway Island, Samoa",
"Pacific/Pago_Pago" : "Pago Pago",
"Pacific/Honolulu" : "Hawaii",
"America/Anchorage" : "Alaska",
"America/Vancouver" : "Vancouver",
"America/Los_Angeles" : "Pacific Time (US and Canada)",
"America/Tijuana" : "Tijuana",
"America/Edmonton" : "Edmonton",
"America/Denver" : "Mountain Time (US and Canada)",
@robertuniqid
robertuniqid / snippet.php
Created June 30, 2020 18:46
eLearnCommerce - Simple Lock WP under login.
<?php
add_action( 'init', function() {
if( is_admin() )
return;
if( is_user_logged_in() )
return;
$trimmed_url = trim( get_site_url(), '/' );
@robertuniqid
robertuniqid / initial.java
Created June 28, 2020 21:04
Fun : Example Refactor of PrimeGenerator
// Code from article here : https://qntm.org/clean
package literatePrimes;
import java.util.ArrayList;
public class PrimeGenerator {
private static int[] primes;
private static ArrayList<Integer> multiplesOfPrimeFactors;
protected static int[] generate(int n) {
@robertuniqid
robertuniqid / example.php
Created June 16, 2020 08:05
Hackish - Prevent username with spaces in it - WordPress
<?php
add_filter( 'pre_user_login', function( $user_login ) {
if( strpos( trim( $user_login ), ' ' ) !== false ) {
add_filter( 'gettext', function( $translation, $text ) {
if( $text === 'Cannot create a user with an empty login name.' )
return __( "You're not allowed to have spaces in your username" );
return $translation;
}, 20, 2 );
@robertuniqid
robertuniqid / code.php
Last active May 4, 2020 15:10
WPEP Center Section
<?php
add_action('init', function () {
add_shortcode('ec_center', function ( $atts, $content ) {
$response = '<div class="wpep-center-section">';
$response .= do_shortcode($content);
$response .= '</div>';
return $response;
});
@robertuniqid
robertuniqid / administration.php
Last active April 20, 2020 22:39
eLearnCommerce - Abstract WPEP_Integration_Email_Marketing
<?php
class WPEP_Integration_Email_Marketing_Coordinator_Administration {
/**
* @var $controller WPEP_Integration_Email_Marketing
*/
protected $_controller;
/**