Skip to content

Instantly share code, notes, and snippets.

@josesayago
josesayago / phpcgi-watcher.sh
Last active February 23, 2021 14:31
PHP-CGI Watcher, a little BASH script to kill PHP-CGI orphan processes draining server resources.
#!/bin/bash
#
# @author Jose SAYAGO
# @uri http://josesayago.com/blog/
#
# Process to monitor how many PHP-CGI processes are running, and kill them
# if they exceed the limit
#
# Set the maximum number of CGI Processes allowed
MAX_CGI=25;
@josesayago
josesayago / facebook.php
Last active September 24, 2020 15:55
Getting Facebook username using Graph API v2.0
<?php
/**
* file_get_contents
*/
// Get User ID from FB SDK, this example uses Facebook PHP SDK v4
$fb_userID = $fb_data['me']['id'];
$fb_graph = 'https://graph.facebook.com/'.$fb_userID;
$fb_request = file_get_contents($fb_graph); // Replace with curl_get_contents if this does not work
$fb_response = json_decode($fb_request);
// Print username
@josesayago
josesayago / login.php
Last active June 1, 2017 12:54
GlotPress custom login page gp-templates/login.php, includes link to registration page.
<?php
gp_title( sprintf( __('%s &lt; GlotPress'), __('Login') ) );
gp_breadcrumb( array(
__('Login'),
) );
gp_tmpl_header();
?>
<h2><?php _e('Login'); ?></h2>
<?php do_action( 'before_login_form' ); ?>
<form action="<?php echo gp_url_ssl( gp_url_current() ); ?>" method="post" class="login-form">
@josesayago
josesayago / network-latest-posts_fullcolor-thumbnails.css
Created January 8, 2016 15:34
Network Latest Posts Stylesheet full color thumbnails
/*
* Network Latest Posts v3.x
*
* Copyright 2016 Jose SAYAGO
* Licensed under the GPL v2.0
* http://www.gnu.org/licenses/gpl-2.0.html
*
*/
/*
* Main Wrapper
@josesayago
josesayago / api-clase.php
Created January 20, 2014 04:03
Grupo de Snippets parte del Artículo: "Crea tu Propio Repositorio de Extensiones Pagas para WordPress" ubicado en http://es.8elite.com/2012/11/05/crea-tu-propio-repositorio-de-extensiones-pagas-para-wordpress/
<?php
/**
* Autor: L'Elite de José SAYAGO
* URL: http://laelitenetwork.com
* Licencia: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
* Fichero: mi-extension-wordpress-api.php
* Clase para la API de actualización de la extensión
*/
class api_actualizacion {
// Versión actual
@josesayago
josesayago / gallery-class.js
Created January 19, 2014 18:28
Code snippets for "jQuery Tricks for Dummies" article, published on http://en.8elite.com/2012/09/13/jquery-tricks-for-dummies/
@josesayago
josesayago / network-latest-posts.php
Last active December 31, 2015 01:18
Network Latest Posts 3.5.5 patch including two additional parameters not yet released: use_pub_date and honor_sticky.
<?php
/*
Plugin Name: Network Latest Posts
Plugin URI: http://en.8elite.com/network-latest-posts
Description: Display the latest posts from the blogs in your network using it as a function, shortcode or widget.
Version: 3.5.5
Author: L'Elite
Author URI: http://laelite.info/
*/
/**
@josesayago
josesayago / facebook_tweaks.css
Created December 3, 2013 23:55
Some Facebook CSS classes tweaked.
#blueBar {
background: rgba(254,254,254,.5);
border-bottom: 1px solid rgba(200,200,200,1);
}
#blueBarHolder #blueBar:after {
background-image: none;
}
.navLink.bigPadding {
@josesayago
josesayago / slposts-default_style.css
Created November 15, 2013 02:39
Single Latest Posts Lite default stylesheet
/*
* Single Latest Posts v1.0
*
* Copyright 2007 - 2013 L'Elite
* Licensed under the GPL v2.0
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Great and ugly things aren't as good
* as great and beautiful things ;)
*/
@josesayago
josesayago / slposts-tanayainfra.css
Created November 15, 2013 02:45
Single Latest Posts Lite CSS Stylesheet adapted for tanayainfra.com
/*
* Single Latest Posts v1.0
*
* Copyright 2007 - 2013 L'Elite
* Licensed under the GPL v2.0
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Great and ugly things aren't as good
* as great and beautiful things ;)
*/