Skip to content

Instantly share code, notes, and snippets.

View ihorvorotnov's full-sized avatar
🇺🇦
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🇺🇦
Working remotely since 1999
View GitHub Profile
<?php
/**
* Setup wp_query arguments for the loop. Cache the results for 4 hours.
*
* @link http://codex.wordpress.org/Transients_API
*/
// Check for transient
if ( ! ( $my_query = get_transient( 'foo_featured_posts' ) ) ) {

SSL certificates aren't cheap. You can create them on your own for private use. However for internet use you have to get a verified certificate.

Luckily there's https://www.startssl.com/

They offer you a class 1 SSL certificate for free. Their site might not look trustworthy, but I quite shure the'll do a greate job.

@ihorvorotnov
ihorvorotnov / README.md
Last active August 29, 2015 14:07 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
<?php
/**
* A class filled with functions that will never go away upon theme deactivation
*
* @package WordPress
* @subpackage GRD
* @version 0.1.0
*/
class GRD_Functions {
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {
scp -r username@remotehost.com:wordpress /local/wordpress
<?php # -*- coding: utf-8 -*-
declare( encoding = 'UTF-8' );
/**
* Plugin Name: Defer Contact Form 7 Scripts
* Description: Adds <code>defer='defer'</code> to enqueued javascripts.
* Version: 1.0
* Required: 3.3
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public