Skip to content

Instantly share code, notes, and snippets.

View cuongdcdev's full-sized avatar
🔥
👷🔨🪚💻

Cuong DC cuongdcdev

🔥
👷🔨🪚💻
View GitHub Profile
@cuongdcdev
cuongdcdev / gist:1ac342b052b15f95c11f6a6fcb334dce
Created January 30, 2019 12:33
class-destination-s3.php
<?php
// Amazon S3 SDK v2.8.27
// http://aws.amazon.com/de/sdkforphp2/
// https://github.com/aws/aws-sdk-php
// http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
use Inpsyde\BackWPup\Helper;
/**
* Documentation: http://docs.amazonwebservices.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html
@cuongdcdev
cuongdcdev / woocommerce-input-fields-bootstrap-classes.php
Created May 5, 2019 14:51
Add the Bootstrap input classes to all WooCommerce input fields
<?php
function lv2_add_bootstrap_input_classes( $args, $key, $value = null ) {
/* This is not meant to be here, but it serves as a reference
of what is possible to be changed.
$defaults = array(
'type' => 'text',
'label' => '',
'description' => '',
@cuongdcdev
cuongdcdev / background.js
Created May 28, 2019 01:38 — forked from akirattii/background.js
Message passing of Chrome Extension example
/*****************************************************************
* onMessage from the extension or tab (a content script)
*****************************************************************/
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.cmd == "any command") {
sendResponse({ result: "any response from background" });
} else {
sendResponse({ result: "error", message: `Invalid 'cmd'` });
}
@cuongdcdev
cuongdcdev / verification.php
Created July 28, 2019 18:02 — forked from jxlwqq/verification.php
Input verification on front and back ends
<?php
protected function form()
{
$form = new Form(new ModelName);
$form->text('title')->rules('required')->required()->help('This field must be required');
$form->text('number')->rules('required|regex:/\d{3}/')->pattern('\d{3}')->help('This field must be three digits');
return $form;
}
@cuongdcdev
cuongdcdev / DNS Prefetch domains
Created October 4, 2019 02:31 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
<?php
use Inpsyde\BackWPup\Settings;
/**
* Class BackWPup_Page_Settings
*/
class BackWPup_Page_Settings {
/**
#!/bin/bash
### Set Language
TEXTDOMAIN=virtualhost
### Set default parameters
action=$1
domain=$2
rootDir=$3
owner=$(who am i | awk '{print $1}')
apacheUser=$(ps -ef | egrep '(httpd|apache2|apache)' | grep -v root | head -n1 | awk '{print $1}')
<?php
/**
* Class in that the BackWPup job runs
*/
final class BackWPup_Job {
const ENCRYPTION_SYMMETRIC = 'symmetric';
const ENCRYPTION_ASYMMETRIC = 'asymmetric';
<?php
/**
* Class for communicating with Dropbox API V2.
*/
final class BackWPup_Destination_Dropbox_API {
/**
* URL to Dropbox API endpoint.
*/
<?php
use \Inpsyde\BackWPup\Pro\Settings;
/**
* BackWPup_Admin
*/
final class BackWPup_Admin {
public $page_hooks = [];