Sometimes when personalizing or translating interfaces, IP geolocation is required.
Besides their subscription based products Maxmind also provides a free IP Geolocation database set. The set is offered under the Creative Commons Attribution-ShareAlike 3.0 Unported License. The free databases maps IPv4 + IPv6 addresses and is being updated once a month. GeoLite Free Downloadable Databases
Another free set of data is provided by IP2location Lite. It is free for personal or commercial use with attribution required
The JSON spec allows integers, fractional numbers, strings, arrays, but when it comes to dates things are handled differently. There really is no date format in the JSON spec. Would be nice if every JSON date output would conform to ISO8601 :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Ruby 2011-07-14 19:43:37 +0100 //ISO 8601 2011-07-14T19:43:37+0100 // Javascript Date Object new Date(1310669017000) // Javascript built-in JSON object 2012-04-23T18:25:43.511Z // .NET JavaScriptSerializer Date(1310669017000) // .NET DataContractJsonSerializer Date(1335205592410-0500) |
Some of these can easily be converted to a PHP timestamp using strtotime(), others require some more magic.
Here is a way to transform the .NET variant, something that has been haunting me in a current project ;)
1 2 3 4 |
preg_match('~(\d+)\d{3}((?:\+|-)\d+)~', $date, $match); $dt = new DateTime('@' . $match[1]); $dt = new DateTime($dt->format('Y-m-d H:i:s') . ' ' . $match[2]); $date = strtotime($dt->format('r')); |
Due to the wide usage of JSON as an exchange format, I really hope we will see a spec update in the future :)
Bootstrap can not be added directly to the admin of a plugin, but you can wrap your plugin in a container and compile the Bootstrap CSS to use it as a wrapper.
I do my compiling using SimpLess
In the past you could do this using SimpLess directly (my-own-bootstrap.less).
1 2 3 |
.bootstrap-wrapper { @import (less) url( 'bootstrap.css' ); } |
This fails with the latest version of Bootstrap. But you can just paste the Bootstrap CSS into the LESS file and compile it that way.
1 2 3 |
.bootstrap-wrapper { // Paste Bootstrap CSS here } |
Run it through SimpLess and after that the new CSS can be enqueued in WordPress ! This also works nicely with themes from Bootswatch.
1 |
wp_enqueue_style( $this->plugin_slug .'-my-bootstrapstyle', plugins_url( 'css/my-bootstrapstyle.css', __FILE__ ), array(), $this->version ); |
Enjoy!
“Masonry is a JavaScript grid layout library. It works by placing elements in optimal position based on available vertical space, sort of like a mason fitting stones in a wall. ”
Still the best solution out there.
Since Facebook introduced the new profile layout people have been complaining about the bad jpeg compression of the cover image.
If you make sure that the following is met, you should be fine:
Some people seem to get better results, if they keep their images under 100KB. I have used images up to 400KB without any problems.
Keep those nice cover images coming!
Cheers
Alex
PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
Ink helps you to get those email templates just right. Nice set of templates to give you a clean start of designing your own.
The JavaScript SVG library for the modern web. Just what the doctor ordered ;)
The Google App Engine has no cURL support, which means that all REST calls need to be executed using file_get_contents.
As Parse REST calls need to be secure, you need to make sure that you send the request with a proper SSL context.
Short example of adding data using the Parse REST API from a Google App Engine application:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$data = array('data1' => 1113, 'data2' => 'Alex', 'data3' => false); $context = array( "ssl"=>array( "allow_self_signed"=>true, "verify_peer"=>false, ), 'http'=> array( "method" => "post", "header" => "X-Parse-Application-Id: YourAppID\r\n" . "X-Parse-REST-API-Key: YourRESTID\r\n" . "Content-Type: application/json\r\n", "content" => json_encode($data) ) ); $context = stream_context_create($context); $result = file_get_contents("https://api.parse.com/1/classes/yourClass", false, $context); |