Skip to content

Instantly share code, notes, and snippets.

View ramiabraham's full-sized avatar

Rami Abraham ramiabraham

View GitHub Profile
javascript:var s = document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0);
@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 );

On Lockpicking

Carrying picking tools is not against the law but context matters (being behind the home depot at 2 am)

Do not pick locks you do not own Do not pick locks which you rely on (bc you can break them)

Pin tumbler locks goes back 4500 yrs

Lockcon

@JayWood
JayWood / fix_msword.php
Last active August 29, 2015 14:25
Fixes MS Word data
/**
* fixMSWord
*
* Replace ascii chars with utf8. Note there are ascii characters that don't
* correctly map and will be replaced by spaces.
*
* Updated 7-15-2015 by Jay Wood to encode lower end items into HTML entity counterparts.
*
* @author Robin Cafolla,Jay Wood
* @date 2013-03-22
@JustinSainton
JustinSainton / notify.php
Created January 27, 2016 23:03
Use existing Gravity Forms notification on non-form data
<?php
$form_id = 12; // Or whatever form ID has the notificaiton you're after
$form = GFAPI::get_form( $form_id );
$notification = end( $form['notifications'] ); // Just an easy way to get the notification I wanted. YMMV.
$lead = array(
'id' => wp_generate_password( 64, true, true ), // Normally, this would be the Lead ID. Not necessary for us.
'form_id' => $form_id,
'source_url' => 'https://site.com/',
'status' => 'active',
'1.3' => $args['first_name'], // YMMV on these args - set them to whatever your form sets them to be.
<?php
$filename = 'csvdata.csv';
header( 'Content-type: text/plain' );
if ( $data = fopen( $filename, 'r' ) ) {
// Snag the first row as column headers
$cols = fgetcsv( $data );
<?php
class Beer {
const NAME = 'Beer!';
public static function printed(){
echo 'static Beer:NAME = '. static::NAME . '<br />';
}
}
class Ale extends Beer {
@ramiabraham
ramiabraham / affwp-wc-referral-by-product-type.php
Last active June 7, 2016 00:22
Adjusts the referral amount based on whether the product is virtual or not.
<?php
/**
* Plugin Name: AffiliateWP - Modify Referral If Virtual Product (WC)
* Plugin URI: https://affiliatewp.com
* Description: Modify referral rate
* Author: AffiliateWP Team
* Author URI: https://affiliatewp.com
* Version: 1.0
*/
function prefix_affwp_modify_referral_if_virtual( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
@norcross
norcross / rkv_referr_source
Created March 30, 2012 18:00
Add referring site to Gravity Forms
function rkv_referr_source() { ?>
<script type="text/javascript">
// build function for cookie process
function rkv_grab_cookie() {
// check document referrer
if (document.referrer !== '')
var rkv_val = document.referrer;