Skip to content

Instantly share code, notes, and snippets.

View agustinprosperi's full-sized avatar

Agustin Prosperi agustinprosperi

View GitHub Profile
@agustinprosperi
agustinprosperi / jquery.example.js
Last active November 1, 2017 11:57
jquery short examples
// wait for images to load
$(window).bind("load", function() {
// code here, masonry for example
});
// validateEmail
function validateEmail(email) {
var re = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
return re.test(email);
}
// Ajax call
@agustinprosperi
agustinprosperi / change_featured_image_labels.php
Last active April 29, 2016 07:55 — forked from slushman/gist:454cc8b26c330727df13
Customize the Featured Image labels
@mikejolley
mikejolley / ipn-test.php
Last active September 5, 2024 01:54
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
@agustinprosperi
agustinprosperi / woocommerce-composites-wpml-fix.php
Last active September 1, 2015 10:02
If you are using WPML with WooCommerce Multilingual, WooCommerce & Composite Products and get an error when attempting to add a Composite to your cart, this snippet might fix the issue.
<?php
/**
* Plugin Name: WooCommerce Composite Products - WPML Cart Error Fix
* Plugin URI: http://www.woothemes.com/products/composite-products/
* Description: If you are using WPML with WooCommerce Multilingual, WooCommerce & Composite Products and get an error when attempting to add a Composite to your cart, this snippet might fix the issue.
* Version: 1.1
* Author: Manos Psychogyiopoulos
* Author URI: http://www.somewherewarm.net/
*
* Requires at least: 3.8
@hissy
hissy / gist:7352933
Created November 7, 2013 11:07
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@afgomez
afgomez / validate_spanish_id.js
Last active November 6, 2024 12:20
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@charlieschwabacher
charlieschwabacher / mixins.scss
Created July 21, 2011 07:41
SCSS mixins for cross browser CSS3 border-radius, transition, gradient, and box shadow
//Cross browser CSS3 mixins
@mixin box-shadow($left, $top, $radius, $color) {
box-shadow: $left $top $radius $color;
-webkit-box-shadow: $left $top $radius $color;
-moz-box-shadow: $left $top $radius $color;
}
@mixin transition($property, $duration, $easing: linear) {
transition: $property $duration $easing;