This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function give_user_subscription( $product, $user_id, $note = '' ){ | |
// First make sure all required functions and classes exist | |
if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){ | |
return false; | |
} | |
$order = wc_create_order( array( 'customer_id' => $user_id ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DKIM is DomainKeys Identified Mail and is used in mail servers, such as Postfix or Sendmail to sign e-mails and thus authenticating the sender so that a forgery can be detected. It also reduces the possibility of an e-mail being flagged as spam, but it's not a definite prevention. | |
A much simpler method is using SPF (Sender Policy Framework) which, in a nutshell, verifies the sender IP address. | |
According to the internet, using both should result to ????, PROFIT !!!. | |
SPF does not need a specific configuration. Whitelisted servers are listed in a DNS record, TXT or SPF, and an example record is: | |
example.com. IN TXT "v=spf1 a mx ~all" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function targetBlank() { | |
// remove subdomain of current site's url and setup regex | |
var internal = location.host.replace(/^[^.]+\./g, ''); | |
internal = new RegExp(internal, "i"); | |
var a = document.getElementsByTagName('a'); // then, grab every link on the page | |
for (var i = 0; i < a.length; i++) { | |
var href = a[i].host; // set the host of each link | |
if (!internal.test(href)) { | |
// make sure the href doesn't contain current site's host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// leastSquaresFit | |
/// Calculate the least square fit linear regression of provided values | |
/// @param {map} $map - A SASS map of viewport width and size value combinations | |
/// @return Linear equation as a calc() function | |
/// @example | |
/// font-size: leastSquaresFit((576: 24, 768: 24, 992: 34)); | |
/// @author Jake Wilson <[email protected]> | |
@function leastSquaresFit($map) { | |
// Get the number of provided breakpoints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_ROOT=$1 # <-- wordpress root directory | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return an ID of an attachment by searching the database with the file URL. | |
* | |
* First checks to see if the $url is pointing to a file that exists in | |
* the wp-content directory. If so, then we search the database for a | |
* partial match consisting of the remaining path AFTER the wp-content | |
* directory. Finally, if a match is found the attachment ID will be | |
* returned. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Used to @include a cursor within a pre-existing class | |
@mixin cursor($cursor-type) { | |
cursor: $cursor-type; | |
} | |
// Used to generate cursor classes | |
@mixin cursor-class($cursor-type) { | |
.#{$cursor-type}-cursor { cursor: $cursor-type; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "advanced-custom-fields/advanced-custom-fields-pro", | |
"version": "5.0", | |
"type": "wordpress-plugin", | |
"dist": { | |
"type": "zip", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var googleMapsLoaded = false; | |
var timeout; | |
if(googleMapsLoaded === false) { | |
timeout = setInterval("checkVariable()", 500); | |
} | |
function doGoogleMapsHook() { | |
// set current zoom level | |
var currentZoom = parseInt(jQuery('#acf-field-zoom_level').val()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name anti key-grabber | |
// @version 1 | |
// ==/UserScript== | |
document.addEventListener('keydown', function(e) { | |
// only if Command key is pressed | |
if (!e.metaKey) { | |
return; | |
} |
NewerOlder