Skip to content

Instantly share code, notes, and snippets.

View ramiabraham's full-sized avatar

Rami Abraham ramiabraham

View GitHub Profile
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@RandomInsano
RandomInsano / Alphie.rst
Last active October 17, 2023 19:22
Edwin's notes from hacking a Playskool Alphie Robot

Alphie (2009) Hacking Notes

Note: I no longer have cards and didn't scan them. You're best bet is eBay, though it's quite expensive.

I want to make my own booster packs for Alphie, a children's learning toy, so I'm learning how he works internally so I can see if it's possible. It may be helpful for someone else down the line, but for right now it's just a lot of fun. Even if I don't get there, it's great practice of both documentation (which I'm terrible at writing) and reverse engineering.

I2C Pinout

@amdrew
amdrew / edd.php
Last active August 29, 2015 14:07
AffiliateWP - Disable referrals on specific product categories in WooCommerce or Easy Digital Downloads
<?php
/**
* Disable referrals on specific product categories in Easy Digital Downloads
*/
function affwp_custom_edd_disable_referrals_on_categories( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
// Array of categories to disable referrals for. Separate by a comma and use either the term name, term_id, or slug
$disabled_categories = array( 'category-one', 5 );
@spivurno
spivurno / gw-gravity-forms-value-exists-validation.php
Last active March 24, 2021 16:08
Gravity Wiz // Gravity Forms // Validate that a Value Exists
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-validate-that-a-value-exists.php
*/
/**
* Gravity Wiz // Gravity Forms // Validate that a Value Exists
*
* Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort
@pippinsplugins
pippinsplugins / gist:d973776836ab984aea06
Created September 3, 2014 22:02
Sets an affiliate user's role to a specific role when being added as an affiliate
<?php
/*
* Plugin name: Affiliate role on registration
*/
function pw_affwp_set_role_on_registration( $affiliate_id = 0 ) {
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = new WP_User( $user_id );
$user->add_role( 'affiliate' );
@hellofromtonya
hellofromtonya / functions.php
Last active September 7, 2016 01:46
Gravity Forms - Add new predefined bulk choices (including specifying label and value)
add_filter('gform_predefined_choices', 'lunarwp\add_predefined_choice');
/**
* Add custom Bulk Predefined Choices to Gravity Forms for Regions
*
* @since 1.0.0
*
* @param array $choices Predefined choices array
* @return array Amended array with our new choices added
*/
function add_predefined_choice($choices)
@ian128K
ian128K / bash_colours
Last active March 8, 2021 18:26
Shell script colours
## Colours and font styles
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}"
# Escape sequence and resets
ESC_SEQ="\x1b["
RESET_ALL="${ESC_SEQ}0m"
RESET_BOLD="${ESC_SEQ}21m"
RESET_UL="${ESC_SEQ}24m"
# Foreground colours
@nickdavis
nickdavis / gist:10525079
Created April 12, 2014 08:41
.htaccess 301 redirect local WordPress dev site images folder to live website images folder (to save fllling up local drive with 1000's of unnecessary images)
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
@hlashbrooke
hlashbrooke / class.php
Created February 28, 2014 08:37
A complete, versatile options page class for any WordPress plugin
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class WordPress_Plugin_Template_Settings {
private $dir;
private $file;
private $assets_dir;
private $assets_url;
private $settings_base;
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*