Skip to content

Instantly share code, notes, and snippets.

@rvanbruggen
rvanbruggen / importtaxonomy.cql
Last active March 10, 2025 21:20
Google Product Taxonomy
//Import Google Product Taxonomy
//WITH IDENTIFIERS
//downloaded from https://support.google.com/merchants/answer/1705911
create index on :Cat1(name);
create index on :Cat2(name);
create index on :Cat3(name);
create index on :Cat4(name);
create index on :Cat5(name);
create index on :Cat6(name);
@ericclemmons
ericclemmons / functions.php
Last active June 23, 2023 01:47
Auto-activate WordPress Plugins
<?php
// Add to: path/to/wp-content/wp-themes/your-theme/functions.php
/**
* Activate required plugins
*/
include_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
@rclark
rclark / lines2polysUnion.js
Last active June 10, 2017 12:34
JSTS to create polygons from spaghetti lines. Union on lines is the "planarize" step, and is extremely time-consuming for larg-ish numbers of lines (~300 it takes about 2 seconds per each new line to union).
var jsts = require("jsts"),
_ = require("underscore"),
fs = require("fs");
fs.readFile("/Users/ryan/Desktop/hv-lines.geojson", function (err, data) {
var geojson = JSON.parse(data),
reader = new jsts.io.GeoJSONReader(),
writer = new jsts.io.GeoJSONWriter(),
polygonizer = new jsts.operation.polygonize.Polygonizer(),
@wpscholar
wpscholar / append-nav-items.php
Last active March 5, 2024 04:26
Add a custom link to the end of a menu that uses the wp_nav_menu() function
<?php
/**
* Add a custom link to the end of a specific menu that uses the wp_nav_menu() function
*/
add_filter('wp_nav_menu_items', 'add_admin_link', 10, 2);
function add_admin_link($items, $args){
if( $args->theme_location == 'footer_menu' ){
$items .= '<li><a title="Admin" href="'. esc_url( admin_url() ) .'">' . __( 'Admin' ) . '</a></li>';
}