Skip to content

Instantly share code, notes, and snippets.

@mircian
mircian / woocommerce_simple_add_to_cart.js
Created September 29, 2018 12:30
Create a simple function which you can globally call to easily add a product to the cart by id.
<script type="text/javascript">
function m_wc_add_to_cart( product_id ) {
if ( 'undefined' === typeof wc_add_to_cart_params ) {
// The add to cart params are not present.
return false;
}
var data = {
product_id: product_id,
#BACKUP YOUR FILES FIRST
#EDITS FOR httpd.conf
#1. Uncomment these lines
LoadModule ssl_module modules/mod_ssl.so
Include /Applications/MAMP/conf/extra/httpd-ssl.conf
#2. Change ServerName value
ServerName localhost:443
#This is just a listing of the commands for generating your SSL certificates
#Run these commands one at a time from inside your ~/ssl folder
#Make sure you create your server.csr.cnf and your v3.ext files first inside the same folder
#private key generation
#This will ask you for a passphrase(password) do NOT lose this file or the password
openssl genrsa -des3 -out ~/ssl/rootCA.key 2048
#create root certificate
openssl req -x509 -new -nodes -key ~/ssl/rootCA.key -sha256 -days 1024 -out ~/ssl/rootCA.pem
authorityKeyIdentifier = keyid, issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
[req]
default_bits= 2048
prompt= no
default_md= sha256
distinguished_name = dn
[dn]
C = CA
ST = ON
L = Ottawa
O = End Point
@stiucsib86
stiucsib86 / composer-teaser.js
Created February 6, 2017 03:45
Visual Composer fixes ".vc_teaser-btn-{{ name }}" error fixes
parse: function() {
var value = this.$data_field.val(),
data = !_.isEmpty(value) ? $.parseJSON(value) : [];
if(_.isEmpty(value)) {
data = [{link: "post", name: "title"}, {name: 'image'}, {name: 'text'}];
this.$data_field.val(JSON.stringify(data));
}
_.each(data, function(block_data){
if(_.isString(block_data.name) && block_data.name.indexOf('{{') < 0) {
var $control = $('.vc_teaser-btn-' + block_data.name, this.$toolbar).prop('checked', true);
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/