(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
| <?php | |
| // Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php) | |
| add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' ); | |
| function woocommerce_header_add_to_cart_fragment( $fragments ) { | |
| ob_start(); | |
| ?> | |
| <a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a> | |
| <?php |
(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
| Model:: | |
| /*Select*/ | |
| select('col1','col2') | |
| ->select(array('col1','col2')) | |
| ->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating')) | |
| ->addSelect('col3','col4') | |
| ->distinct() // distinct select | |
| /*From*/ |
| function replaceElementTag(targetSelector, newTagString) { | |
| $(targetSelector).each(function(){ | |
| var newElem = $(newTagString, {html: $(this).html()}); | |
| $.each(this.attributes, function() { | |
| newElem.attr(this.name, this.value); | |
| }); | |
| $(this).replaceWith(newElem); | |
| }); | |
| } |
| import React from "react"; | |
| import { render } from "react-dom"; | |
| const ParentComponent = React.createClass({ | |
| getDefaultProps: function() { | |
| console.log("ParentComponent - getDefaultProps"); | |
| }, | |
| getInitialState: function() { | |
| console.log("ParentComponent - getInitialState"); | |
| return { text: "" }; |
| // -------------------------------------------------- | |
| // Flexbox SASS mixins | |
| // The spec: http://www.w3.org/TR/css3-flexbox | |
| // -------------------------------------------------- | |
| // Flexbox display | |
| @mixin flexbox { | |
| display: -webkit-box; | |
| display: -moz-box; | |
| display: -ms-flexbox; |
| add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); | |
| /** | |
| * custom_woocommerce_template_loop_add_to_cart | |
| */ | |
| function custom_woocommerce_product_add_to_cart_text() { | |
| global $product; | |
| $product_type = $product->get_type(); | |
| switch ( $product_type ) { |
| #!/bin/bash | |
| laravel new $1 | |
| cd $1 | |
| composer install | |
| yarn install | |
| touch README.md | |
| cp .env.example .env | |
| git init | |
| git add -A |
| /* -------------------------------------------------------------------------- */ | |
| // All Bootstrap 4 Sass Mixins [Cheat sheet] | |
| // Updated to Bootstrap v4.5.x | |
| // @author https://anschaef.de | |
| // @see https://github.com/twbs/bootstrap/tree/master/scss/mixins | |
| /* -------------------------------------------------------------------------- */ | |
| /* | |
| // ########################################################################## */ | |
| // New cheat sheet for Bootstrap 5: |