Skip to content

Instantly share code, notes, and snippets.

View klihelp's full-sized avatar
🎯
Focusing on life and money farm

klihelp

🎯
Focusing on life and money farm
View GitHub Profile
@woogist
woogist / functions.php
Created December 12, 2014 10:41
Change the number of related products in the single product page
/**
* Change the number of related products in the single product page.
*
* @param array $args
* @return array
*/
function wc_custom_related_products_number( $args ) {
if ( isset( $args['posts_per_page'] ) ) {
$args['posts_per_page'] = 8;
}
@woogist
woogist / functions.php
Created December 10, 2014 13:55
Mark order status as completed automatically
add_filter( 'woocommerce_payment_complete_order_status', 'wc_skip_processing' );
function wc_skip_processing( $status, $order_id ) {
return 'completed';
}

using multiple Arrays in gulp.src

var gulp = require('gulp');

gulp.task('build', function() {
    var srcFiles = ['file1.js', 'file2.js'],
        otherSrcFiles = ['file3.js', 'file4.js'];
    gulp.src(srcFiles.concat(otherSrcFiles));
});
@woogist
woogist / functions.php
Created October 15, 2014 10:04
Increase the import limit for WooCommerce Product CSV Import Suite
<?php
/**
* Increase the import limit for WooCommerce Product CSV Import Suite
*/
add_filter( 'woocommerce_csv_import_limit_per_request', create_function( '', 'return 20;' ) ); //Increase limit to 20
@woogist
woogist / functions.php
Last active September 27, 2015 14:59
Add product dimension and weight to the order CSV export
/**
* Add weight as line item meta in CSV export
*/
function sv_add_weight_to_csv_export_line_item( $line_item, $item, $product, $order ) {
if ( $product->get_weight() ) {
$line_item['weight'] = $product->get_weight() . ' ' . get_option( 'woocommerce_weight_unit' );
}
if ( $product->length ) {
@JoostKiens
JoostKiens / index.html
Last active November 7, 2016 14:29
Checkboxes with css, no js
<div>
<input type="checkbox" id="floep">
<label for="floep">Floep</label>
</div>
<div>
<input type="checkbox" id="flap" checked="checked">
<label for="flap">Flap</label>
</div>
@clineamb
clineamb / month_select.nunjucks
Last active November 1, 2023 12:32
Nunjucks Date/Time Field Macros
/*
* For use with the nunjucks templating system
* http://mozilla.github.io/nunjucks
*
* I created a bunch of macros for quickly creating date/time fields.
* Import into your nunjucks template:
* "{% import "path/to/datefields.nunjucks" as datefields %}"
* And use...
* {{ datefields.month_select("yo_month", "M", "", "form-control") }}
*
@schilke
schilke / functions.php
Last active February 23, 2023 18:53
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
@mathisonian
mathisonian / index.md
Last active August 10, 2024 20:59
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@garbados
garbados / gist:f82604ea639e0e47bf44
Created July 27, 2014 23:07
Falsehoods Programmers Believe About Gender
  1. There are two and only two genders.
  2. Okay, then there are two and only two biological genders.
  3. Gender is determined solely by biology.
  4. Okay, it’s mostly determined by biology, right?
  5. Please tell me it’s determined by DNA.
  6. Gender can be reliably determined through visual means. After all, no man would ever wear a burka.
  7. Once gender is set, it never changes.
  8. Even if the gender can change, it will only change from the one value to the other value.
  9. Only one gender can be “active” at the same time.
  10. We’re tracking gender now, so we’ve always tracked it.