Skip to content

Instantly share code, notes, and snippets.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
diff --git a/wp-content/plugins/qtranslate/qtranslate_core.php b/wp-content/plugins/qtranslate/qtranslate_core.php
index 17b4669..9ac128a 100644
--- a/wp-content/plugins/qtranslate/qtranslate_core.php
+++ b/wp-content/plugins/qtranslate/qtranslate_core.php
@@ -414,6 +414,7 @@ function qtrans_updateTermLibrary() {
function qtrans_strftime($format, $date, $default = '', $before = '', $after = '') {
// don't do anything if format is not given
+ return $default;

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

/***************************************************************
* Function media_custom_validation
* Check the media form for duplicate inputs on the same day
***************************************************************/
add_filter('gform_validation', 'media_custom_validation');
function media_custom_validation($validation_result) {
global $form_email, $file_id;
@jevgen
jevgen / homebrew.md
Last active August 29, 2015 14:17 — forked from thomjoy/homebrew.md

Homebrew

Uninstall

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

Install cask

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@jevgen
jevgen / Contract Killer 3.md
Last active August 29, 2015 14:27 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@jevgen
jevgen / Styling Gravity Forms Error Messages
Last active September 3, 2015 19:30 — forked from scottmcdaniel/Styling Gravity Forms Error Messages
Styling Gravity Forms Error Messages
/* Gravity forms error handling - February 5, 2014 */
/* ############################################### */
/* Make the error stand out */
.gfield_error{
background-color: white;
color:#b94a48;
}
/* Prepend the error message to the missing but required field */
.gfield_error:before {
@jevgen
jevgen / functions.php
Created June 30, 2016 12:11 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
global $wp_styles;
// Load the main stylesheet
wp_enqueue_style( 'my-theme', get_stylesheet_uri() );
@jevgen
jevgen / gravity_forms_validation.php
Created July 6, 2016 14:30 — forked from BronsonQuick/gravity_forms_validation.php
Change the default validation message and add validation on default values in Gravity Forms
<?php
//This is a filter to change the default validation message that Gravity Forms generates
add_filter('gform_validation_message', 'change_validation_message', 10, 2);
function change_validation_message($message, $form)
{
return "<div class='validation_error'><strong>Oops!</strong> Looks like there’s something wrong. Please review the form above.</div>";
}
// Often forms in Gravity Forms to need to start with default values and we need to check the form in case the user hasn't entered new data and give them a validation message back
@jevgen
jevgen / gist:ac67e729a4a68737e03427b9e2cdb5c0
Created August 11, 2016 07:46 — forked from mosne/gist:25d639b723825b894751
qTranslate-X Support for Google XML Sitemaps Generator for WordPress
<?php
/*
Description: qTranslate Support for Google XML Sitemaps Generator for WordPress
Copyright(c): 2011, DSmidge, http://blog.slo-host.com/
License: GNU GPL, http://www.gnu.org/licenses/gpl-3.0.txt
This code is based on changes between plugin "Google XML Sitemaps Generator
with qTranslate Support for WordPress, v3.1.6.3" by NeoEGM and "Google XML
Sitemaps Generator for WordPress, v3.1.6" by Arne Brachhold.