Instantly share code, notes, and snippets.

View varnish.php
<?php
/**
* Send data to Varnish
*
* @since 2.6.8
*
* @param string $url The URL to purge.
* @return void
*/
function rocket_varnish_http_purge( $url ) {
View keybase.md

Keybase proof

I hereby claim:

  • I am falexandrou on github.
  • I am falexandrou (https://keybase.io/falexandrou) on keybase.
  • I have a public key ASCkxsN8ltxAfUxD0WYm3WKADZ7aiVSq2up2MqF4stqKogo

To claim this, I am signing this object:

View crop.util.css
.crop {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
View gist:ea77b8f00df3718fa4b420599f6989f5
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 start time 1: 2017-02-10 20:42:30 start time 2: 2017-02-10 21:12:30 [] []
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 end time 1: 2017-02-12 20:40:47 end time 2: 2017-02-12 21:10:47 [] []
[2017-11-13 13:00:03] production.DEBUG: Analyzing contest Siamo Alla Frutta [] []
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 start time 1: 2017-02-11 20:07:42 start time 2: 2017-02-11 20:37:42 [] []
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 end time 1: 2017-02-27 20:07:42 end time 2: 2017-02-27 20:37:42 [] []
[2017-11-13 13:00:03] production.DEBUG: Analyzing contest the beautiful contest ever [] []
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 start time 1: 2017-02-18 03:29:17 start time 2: 2017-02-18 03:59:17 [] []
[2017-11-13 13:00:03] production.DEBUG: now: 2017-11-13 13:00:03 end time 1: 2017-02-28 03:29:17 end time 2: 2017-02-28 03:59:17 [] []
[2017-11-13 13:00:03] product
View stock_sales.sql
SELECT
p.post_title AS "Product title",
t1.meta_value AS "Items Sold",
t2.meta_value AS "Current Stock Quantity",
NOW() AS "Current Date"
FROM
wp_posts p
LEFT JOIN (SELECT meta_value, post_id FROM wp_postmeta WHERE meta_key='total_sales') t1 ON t1.post_id=p.ID
LEFT JOIN (SELECT meta_value, post_id FROM wp_postmeta WHERE meta_key='_stock') t2 ON t2.post_id=p.ID
WHERE p.ID=102176;
View jetpack.php
<?php
// Jetpack custom cron schedule to reduce cron load
// Add it in your site-speicic plugin or the theme's functions.php
add_filter( 'jetpack_sync_incremental_sync_interval', function() { return 'hourly'; } );
add_filter( 'jetpack_sync_full_sync_interval', function() { return 'daily'; } );
add_filter( 'jetpack_sync_listener_should_load', '__return_false' );
add_filter( 'jetpack_sync_sender_should_load', '__return_false' );
add_filter( 'pre_option_jetpack_sync_settings_sync_via_cron', '__return_zero' );
View gc.php
<?php
# If you've exceeded the number of inodes on your server,
# you could as well run `php -a` so you get the interactive shell running
# and then copy & paste the following lines into
# Make sure we're using files as a session save handler
ini_set('session.save_handler', 'files');
ini_set("session.save_path", "/var/lib/php/session");
# The probability of performing garbage cleanup is the ratio:
View view-pdf.js
/**
* When browser supports inline pdfs
* There is no need to append a large jquery plugin that displays them inline.
*
* You can actually use an iframe (and style it appropriately)
* or a link whenever inline PDF viewing is not supported
*
* This function is fairly simple and it's only for demo purposes
*/
function appendPdf(id, url) {
View sendfile.sh
# A VirtualBox bug forces vagrant to serve
# corrupt files via Apache or nginx
# The solution to that would be to turn off
# the SendFile option in apache or nginx
#
# If you use apache as your main web server
# add this directive in your httpd.conf (or apache.conf)
# configuration file name may vary in various systems
#
EnableSendfile off
View gist:5529114
# If you've been locked out of kloxo and you've tried everything google suggested for you
# then most likely it's a database problem. Please try the following at your own will
# and hit cmd+y (or ctrl+w) if you don't know the impact this will have on your system.
# Disclaimer: if you break your server it won't be my fault. you've been warned
#
# The "recommended" way to login to your kloxo installation is the following:
# as described in http://wiki.lxcenter.org/Change+Password+via+SSH
[root@server]$ sh /script/resetpassword master {newpassword}
# if this doesn't work try the following: