Skip to content

Instantly share code, notes, and snippets.

View jin0x's full-sized avatar
:octocat:
Working from home

John Leskas jin0x

:octocat:
Working from home
View GitHub Profile
#!/usr/bin/python
"""
advanced-flood.py
@author: Randall Degges
@email: rdegges@gmail.com
@date: 11-20-09
This program floods the specified phone number and spoofs caller ID making it
@jin0x
jin0x / docker-compose.yml
Created December 8, 2019 19:52 — forked from drdogbot7/docker-compose.yml
Wordpress Docker Compose with CLI - official images
version: '2'
services:
db:
image: mysql:5.7
volumes:
- "./.data/db:/var/lib/mysql"
ports:
- "[YOUR_DESIRED_SQL_PORT]:3306"
environment:
MYSQL_ROOT_PASSWORD: wordpress
@jin0x
jin0x / Αdd default values to ACF Repeater Fields (README)
Last active December 5, 2019 12:07 — forked from theJasonJones/README.md
Auto Populate Wordpress ACF Repeater values
# Add default values to ACF Repeater Fields
I came across this solution when I had about a ton of posts (200+) with values in various PDFs. I didn't want to have to spend time filling out the same values over and over again.
## Walkthrough
This case is pretty straight forward; I have one repeater field *field_123a56b7cb890* that has a text fields inside it (*field_588a24c3cb782*). I haven't tried any other types like post objects or radio buttons, but I'm sure it can be done.
**Step 1.** Hook into **acf/load_value** on your repeater field. You can use type/key/name as desired here.
@jin0x
jin0x / functions.php
Created December 5, 2019 11:48 — forked from vielhuber/functions.php
Advanced Custom Fields ACF dynamically set default value #wordpress
<?php
add_filter('acf/load_field/name=field_name', function($field) {
global $post;
// variant 1 (use get_post_meta instead of get_field to avoid conflicts)
if( get_post_meta($post->ID, 'field_name', true) == '' ) {
$field['value'] = 'FOO';
}
// variant 2
@jin0x
jin0x / block-template.php
Created December 5, 2019 11:16 — forked from zgordon/block-template.php
Example of how to add block templates to post types in WordPress
<?php
function mytheme_block_templates( $args, $post_type ) {
// Only add template to 'post' post type
// Change for your post type: eg 'page', 'event', 'product'
if ( 'post' == $post_type ) {
// Optionally lock templates from further changes
// Change to 'insert' to allow adding other blocks, but lock defined blocks
@jin0x
jin0x / functions.php
Created November 20, 2019 20:08 — forked from CrispDev/functions.php
Autoship Customization // Toggle an Orders Autoship Scheduled Items based on Shipping Address in Checkout
/**
* Checks if the supplied address is a valid autoship address.
* @param array $address
*/
function xx_autoship_valid_shipping_address( $address ){
// Add Any Address Checks to filter here ( i.e. valid city, state, zip, country )
return apply_filters( 'xx_autoship_valid_shipping_address', 'US' == $address['shipping_country'], $address );
import {
useRef, useCallback, useEffect, useState
} from 'react';
import smoothscroll from 'smoothscroll-polyfill';
smoothscroll.polyfill();
function useSmoothScroll() {
const scrollRafPending = useRef(false);
const scrollRafInstance = useRef(false);
@jin0x
jin0x / sidebar.php
Last active September 18, 2019 23:44 — forked from rhurling/sidebar.php
Widget & Sidebar Endpoints for the WordPress REST API v2
<?php
use WP_REST_Server;
use WP_REST_Request;
use WP_REST_Response;
use WP_Error;
class Sidebar extends \WP_REST_Controller {
/**
@jin0x
jin0x / woocommerce-stock-filter-for-wordpress-admin.php
Created June 6, 2019 11:14 — forked from vyskoczilova/woocommerce-stock-filter-for-wordpress-admin.php
WooCommerce add stock filter to WordPress Admin (Products)
/**
* @snippet Add Stock Filter to Products page in WordPress admin | WooCommerce
* @comment Localization is automatic if you have localized WooCommerce to your language
* @source https://gist.github.com/vyskoczilova/fbc9dd818af20ff514cdb2d50eab410a
* @updatedversionof https://popoleodesigns.com/add-inout-of-stock-filter-to-wordpress-admin/
* @author Karolína Vyskočilová
* @testedwith WooCommerce 3.0.7
*/
// -------------------
@jin0x
jin0x / functions.php
Created June 4, 2019 17:18 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field