Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🏠
Working remotely since 1999
View GitHub Profile
@slaFFik
slaFFik / expose.php
Created Jan 31, 2021
Fix Expose by BeyondCode issues when working with the local WordPress site
View expose.php
<?php
// phpcs:ignoreFile
define( 'EXPOSED_DOMAIN', 'example.sharedwithexpose.com' );
// Load only if we are running under Expose.
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || $_SERVER['HTTP_X_ORIGINAL_HOST'] !== EXPOSED_DOMAIN ) {
return;
}
@janispritzkau
janispritzkau / analytics.js
Last active Oct 12, 2021
Minimal Google Analytics Script (677 bytes minified)
View analytics.js
((document, location, navigator) => {
const domain = location.hostname.split(".")
const match = document.cookie.match(/(^|; ?)_ga=GA1\.\d\.(\d+\.\d+)(;|$)/)
// use existing client id or generate one
const cid = match ? match[2] : ~~(2147483648 * Math.random()) + "." + ~~(Date.now() / 1000)
// set cookie at highest possible domain level
for (let i = domain.length; i--;) {
const cookie = `_ga=GA1.${domain.length - i}.${cid}`
@mishterk
mishterk / responsive-oembeds-class-for-wp.php
Created Jan 9, 2020
Wraps oEmbed output in markup which we can then target with CSS for fluid responsiveness.
View responsive-oembeds-class-for-wp.php
<?php
class ResponsiveOEmbeds {
/**
* Regex patterns for matching specific embeddable URLs
*
* @var array
*/
@gokulkrishh
gokulkrishh / useful-npx-commands.md
Last active Oct 15, 2021
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)
View useful-npx-commands.md

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands

@mtunjic
mtunjic / disable.sh
Last active Oct 21, 2021 — forked from pwnsdx/disable.sh
Disable bunch of #$!@ in Catalina
View disable.sh
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
View unset-woocommerce-order-actions.php
<?php
add_filter( 'woocommerce_order_actions', function ( $actions ) {
// Unset whatever actions you don't need available in the
// WooCommerce order edit screen.
unset( $actions['send_order_details_admin'] );
unset( $actions['send_order_details'] );
unset( $actions['regenerate_download_permissions'] );
View class-make-release-command.php
<?php
namespace WpLandingKitPlugin;
use WP_CLI;
use WP_CLI_Command;
View class-view.php
<?php
class View {
public static $view_dir = '';
/**
* Render View Template With Data
@mishterk
mishterk / app.php
Last active Jul 1, 2020
An example illustrating PHP's ability to return data from included files. For more info, see https://philkurth.com.au/tips/included-files-can-return-values-which-is-a-great-way-to-manage-app-configurations/
View app.php
<?php
$config = include 'config.php';
echo $config['some']; // 'config'
@mishterk
mishterk / Dump.php
Created Oct 19, 2019
A simple static class for dumping information to a log file of your choosing. For more info, see https://philkurth.com.au/tips/a-php-class-for-dumping-data-to-a-separate-log-file/
View Dump.php
<?php
/**
* Class Dump
* A simple static class for dumping data to a separate log file to aid debugging and development.
*
* @author Phil Kurth <phil@philkurth.com.au>
*/
class Dump {