Python Snippets

Basic setup codeSetup Snippets$ sudo apt-get install python sudo apt-get install python3 sudo apt-get install python-pip sudo apt-get install python3-pip # PIP with easy install (sudo) # Suitable for PI's, but not Ardunio Yun. apt-get install curl curl -O...

read more

Twig Snippets

This is a collection of my most used Twig snippets, developed with Twig 1.8. // Urlify simple filter for Twig $filter = new Twig_SimpleFilter('urlify', function ($string) { return URLify::filter($string); }); $twig->addFilter($filter); // Example: {{...

read more

PHP Snippets

A collection of snippets used for editing arrays. // Lock Page/Admin Access to Specific list of IPs // static IP list $whitelistedIps = array( '1.1.1.1.', '2.2.2.2', // Live Server '3.3.3.3', // Load Balancer ); // Add IP's from dynamic domains $whitelistedIps[] =...

read more

Drupal Snippets

// Get drupal's root url $GLOBALS['base_url'] => http://example.com/drupal base_path() => /drupal/ request_uri() => /drupal/documentation?page=1 request_path() => documentation current_path() => node/26419 // Print Views Block from Node TPL + Pass...

read more

PHP CIDR To Range Reader Function

function cidrToRange($cidr) { $range = array(); $cidr = explode('/', $cidr); $range[0] = long2ip((ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1])))); $range[1] = long2ip((ip2long($cidr[0])) + pow(2, (32 - (int)$cidr[1])) - 1); return $range; }...

read more

PHP Version History

I recently stumbled across a client server that is still running PHP5.3. This is worrying as their SLA stipulates that they are to be provided with a secure server. As you can see, in the diagram above, there is no long any support for PHP5.3. Any further security issues exposed in PHP5.3 will never be fixed.

read more
Share This