Skip to content

Instantly share code, notes, and snippets.

Avatar

Mattias Fjellvang simplenotezy

View GitHub Profile
View groundwaterStyles.js
import { Circle, Stroke, Style, Fill } from "ol/style";
import Feature from "ol/Feature";
import Point from "ol/geom/Point";
const percentileOpacity = 0.3;
export const percentileConfigs = [
{
value: "p99",
color: "#083092",
@simplenotezy
simplenotezy / class-pclzip.php
Created Oct 4, 2020
(maybe) infected core wordpress files
View class-pclzip.php
<?php
// --------------------------------------------------------------------------------
// PhpConcept Library - Zip Module 2.8.2
// --------------------------------------------------------------------------------
// License GNU/LGPL - Vincent Blavet - August 2009
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
// Presentation :
// PclZip is a PHP library that manage ZIP archives.
@simplenotezy
simplenotezy / package.json
Created Mar 26, 2020
slow nuxt build generate
View package.json
{
"name": "jwr-nuxt",
"version": "1.0.0",
"description": "My stylish Nuxt.js project",
"author": "Mattias Siø Fjellvang",
"private": true,
"scripts": {
"dev": "export NODE_TLS_REJECT_UNAUTHORIZED=0 && nuxt --env.NODE_TLS_REJECT_UNAUTHORIZED=0",
"build": "nuxt build",
"start": "nuxt start",
View gist:cdb711d2f5634b79c2385f0977c0b7bf
12:50:09 PM: Build ready to start
12:50:12 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
12:50:12 PM: build-image tag: v3.3.7
12:50:12 PM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c
12:50:12 PM: Fetching cached dependencies
12:50:12 PM: Failed to fetch cache, continuing with build
12:50:12 PM: Starting to prepare the repo for build
12:50:13 PM: No cached dependencies found. Cloning fresh repo
12:50:13 PM: git clone https://github.com/The-Jewellery-Room/jwr-nuxt
12:50:14 PM: Preparing Git Reference refs/heads/master
@simplenotezy
simplenotezy / functions.php
Last active Feb 12, 2020
Retrieve shop / archive / category products through custom WordPress REST API endpoint with associated filters
View functions.php
<?php
/**
* This allows you to get the archive page / shop page data through the WordPress REST APi.
* It's not beautiful, but it works.
*
* The REST URL: https://yourwebsite.com/wp-json/custom-woocommerce/v1/shop/slug
*
* Parameters:
* "filter_{attribute_name}=some_value", e.g. "/shop/?filter_color=red". You can filter multiple values: ?filter_color=red,blue&filter_size=1,2
* "categories", e.g. "/shop/?categories=shoes,shirts&filter_color=blue"
@simplenotezy
simplenotezy / install-wp-plugin.php
Last active May 27, 2020
Programatically install and activate WordPress plugins - automatically find activation path - based on: https://gist.github.com/squarestar/37fe1ff964adaddc0697dd03155cf0d0
View install-wp-plugin.php
<?php
/*
* Hide the 'Activate Plugin' and other links when not using QuietSkin as these links will
* fail when not called from /wp-admin
*/
class QuietSkin extends \WP_Upgrader_Skin {
public function feedback($string, ...$args) { /* no output */ }
@simplenotezy
simplenotezy / wp-cli.php
Last active Oct 23, 2019
Migrate from "WooCommerce Multi Currency Premium" to WPML's own multi-currency
View wp-cli.php
<?php
/**
* Below script helps you migrate from "WooCommerce Multi Currency Premium" by VillaTheme to WPML's own multi-currency
* This is helpful if you've added WPML to your site, after setting up multi currency, and would like to lower
* your plugin overhead, or if you're experiecing issues with VillaTheme's plugin.
*
* Esentially, when you run below script, it will migrate all the postmeta from your products / variations from meta
* values "_DKK" to "_price_DKK", etc.
*
* NOTE: This script does not handle scheduled prices, but it can be easilly managed. Also sale price is not included,
@simplenotezy
simplenotezy / gist:c30ca5b0aea87ec0df57
Created Feb 8, 2016
Decode 64 hexadecimal characters APNS token to 32bit
View gist:c30ca5b0aea87ec0df57
function base64_decode_apns_token($token) {
$a = unpack("H*hex", base64_decode($token));
$b = str_split($a["hex"], 8);
$output = "";
foreach ($b as $current) {
$output .= "$current";
}
return trim($output);