Skip to content

Instantly share code, notes, and snippets.

@ramonfincken
ramonfincken / WooCommerce_search_order_ip.php
Last active May 2, 2024 17:18
Add search by customer IP address to Woocommerce order search
<?php
// NOTE, see updates function managedwphosting_woocommerce_order_query_args
/**
* Inspired by https://stackoverflow.com/questions/53140009/add-search-by-customer-ip-address-to-woocommerce-order-search
* Code idea borrowed from https://www.skyverge.com/blog/filtering-woocommerce-orders/ && https://gist.github.com/bekarice/41bce677437cb8f312ed77e9f226a812
*/
add_filter( 'request', 'filter_orders_by_payment_method_query' );
function filter_orders_by_payment_method_query( $vars ) {
@nickytonline
nickytonline / async-awaitable-dom-event-handler.js
Last active May 2, 2024 17:18
async/await"able DOM event handlers
// async/await"able" DOM event handlers
async function getMeSomeData() {
// ...
return data
}
document.addEventListener('DOMContentLoaded', async () => {
const someContainer = document.getElementById('someContainer');
@metatablecat
metatablecat / b64.lua
Last active May 2, 2024 17:17
The fastest luau base64 library in the west. This has been benchmarked within Roblox Luau, results may vary
local SEQ = {
[0] = "A", "B", "C", "D", "E", "F", "G", "H",
"I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X",
"Y", "Z", "a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n",
"o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "0", "1", "2", "3",
"4", "5", "6", "7", "8", "9", "+", "/",
}
@algal
algal / loadPoints.swift
Created December 28, 2018 19:41
Read vertex positions with Model I/O
// known-good: Swift 4.2, macOS
import Foundation
import ModelIO
private func LogDebug(_ s:Any) -> Void { print(s) }
private func LogInfo(_ s:Any) -> Void { print(s) }
private func LogError(_ s:Any) -> Void { print(s) }
struct POINT3D {
var x:Float
@manuelvicnt
manuelvicnt / ProvideViewModels.kt
Last active May 2, 2024 17:16
Scope ViewModels to Composables
// PLEASE, READ
//
// This is a way to scope ViewModels to the Composition.
// However, this doesn't survive configuration changes or procress death on its own.
// You can handle all config changes in compose by making the activity handle those in the Manifest file
// e.g. android:configChanges="colorMode|density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode">
//
// This is just an exploration to see what's possible in Compose. We don't encourage developers to copy-paste
// this code if they don't fully understand the implications of it and if this actually solves the use case to solve.
@bennadel
bennadel / app.component.ts
Created May 1, 2018 12:42
Creating A Medium-Inspired Text Selection Directive In Angular 5.2.10
// Import the core angular services.
import { Component } from "@angular/core";
// Import the application components and services.
import { TextSelectEvent } from "./text-select.directive";
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
interface SelectionRectangle {
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 2, 2024 17:11
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@dvf
dvf / change-codec.md
Last active May 2, 2024 17:10
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@JamesSimpson
JamesSimpson / perfex_hooks_list
Last active May 2, 2024 17:04
Full Perfex Hook List - For Perfex CRM Developers
File ---> application\controllers\admin\Authentication.php:
23: hooks()->do_action('admin_auth_init');
80: hooks()->do_action('after_staff_login');
107: hooks()->do_action('after_staff_login');
117: hooks()->do_action('after_staff_login');
219: hooks()->do_action('after_user_logout');
File ---> application\controllers\admin\Auto_update.php:
14: hooks()->do_action('before_perform_update', $latest_version);