Skip to content

Instantly share code, notes, and snippets.

@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 / nlp-cicerone.css
Created June 12, 2015 14:38
NLP Stylesheet customized for Cicerone
/**
* Network Latest Posts v3.0
*
* Copyright 2012 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_titles.css
Created May 18, 2015 21:47
Single Latest Posts titles font size customization.
/*
* 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 / 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 / slposts-notitles.css
Created April 1, 2015 03:16
Hides Single Latest Posts post titles.
/*
* Single Latest Posts v1.7.3
*
* Copyright 2007 - 2015 L'Elite
* Licensed under the GPL v2.0
* http://www.gnu.org/licenses/gpl-2.0.html
*
*/
/*\
* =========================
@josesayago
josesayago / nlp-fontawesome.css
Last active August 29, 2015 14:10
Network Latest Posts Unordered List using Font Awesome Bullet Icons.
/*
* Network Latest Posts v3.0
*
* Copyright 2012 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 / dynamic_scale.js
Last active August 29, 2015 14:10
KineticJS dynamic scale
function _dynamicScale( params ) {
gutter = 200;
initialScale = params.zoom;
initialWidth = jQuery('#canvasEditor').innerWidth();
initialHeight = jQuery('#canvasEditor').innerHeight();
width = initialWidth / initialHeight * ( jQuery(window.top).innerHeight() - gutter );
height = jQuery(window.top).innerHeight() - gutter;
xScale = ( width / initialWidth ) * initialScale.x;
yScale = ( height / initialHeight ) * initialScale.y;
scale = { x: xScale, y: yScale };
@josesayago
josesayago / nlposts_shortcode_form.php
Last active August 29, 2015 14:09
Replaces wp-config.php by wp-load.php to avoid shortcode errors when working with hardened WordPress installations.
<?php
/*
Network Latest Posts Shortcode Form
Version 3.5
Author L'Elite
Author URI http://laelite.info/
*/
/* Copyright 2012 L'Elite (email : opensource@laelite.info)
This program is free software; you can redistribute it and/or modify
@josesayago
josesayago / phpcgi-cronjob.sh
Created October 28, 2014 07:41
Create a Cronjob for the PHP-CGI Watcher
# Create a Cronjob
~ $ crontab -e
# Cron Editor
# Run every minute
* * * * * /path/to/phpcgi-watcher.sh
# Clean up logfile every hour (optional)
*/60 * * * * echo '' > /var/log/phpcgi-watcher.log
:wq
# Check the cronjob was successfuly created
~ $ crontab -l
@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;