[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]
by Web Desk via Digital Information World
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
Mesh is a JavaScript code editor that feels like a spreadsheet.
Specifically, Mesh is a spreadsheet UI wrapper around a text file editor. Actions on the grid are automatically translated to changes in the JavaScript code.
Have you noticed the social networks seem to change every week? How can anyone possibly keep up, right? We have a great new (and free) solution for you–the busy marketer. I’m excited to announce the new Social Media Marketing Talk Show audio podcast. Each week your friends at Social Media Examiner bring you: #1 News: [...]
This post Our New Podcast: Social Media Marketing Talk Show first appeared on .
- Your Guide to the Social Media Jungle
Oftentimes in our line of work we need to be able to replicate a user journey repeatedly to make sure that our pages are offering a consistent experience as we make changes to our site. Critical to being able to accomplish this consistently and conveniently are libraries that allow us to script these types of tests, so that we can run assertions against them and maintain documentation around the results. Enter headless browsers: command line tools that provide you with the ability to script a user's interactions across your site programmatically and capture the results to use in tests.
Many of us have been using PhantomJS, CasperJS, and other tools for years to do just this. But, as often is with love, our hearts can be bequeathed to another. As of Chrome 59 (60 for Windows users), Chrome ships with its own headless browser. And, although it doesn't currently offer support for Selenium, it uses Chromium and the Blink engine, i.e. it is simulating an actual user experience in Chrome.
As ever, the code for this article can be found on our GitHub repo.
Running Headless Chrome from the command line is relatively easy. On a Mac, you can set an alias for Chrome and run using the —headless command line parameter
alias chrome="/Applications/Google\ http://ift.tt/KHAAUB\ Chrome”
chrome --headless --disable-gpu --remote-debugging-port=9090 http://ift.tt/1OBPPhE
On Linux, it's even easier:
google-chrome --headless --disable-gpu --remote-debugging-port=9090 http://ift.tt/1OBPPhE
--headless: Runs without a UI or display server dependencies--disable-gpu: Disables GPU hardware acceleration. This is temporarily needed for now.--remote-debugging-port: Enables remote debug over HTTP on the specified port.You can also interact with the page you are requesting, for example to print document.body.innerHTML to stdout you can do:
google-chrome --headless --disable-gpu --dump-dom http://endless.horse/
If you're curious what else is possible, a full list of parameters can be found here.
The focus of this article however, is not the command line, rather running Headless Chrome in Node.js. To do this, we're going to need the following modules:
Continue reading %Quick Tip: Getting Started with Headless Chrome in Node.js%
Laravel 5.5 will require PHP 7.0+. For the features this modern PHP version brings, please see our recap.
Laravel 5.5 will also be the next LTS (Long Term Support) release. This means bugfixes for two years and three years of security updates. That was also the case with Laravel 5.1, but its two-year window of bug fixes is coming to an end this year. Without further ado, let's see what this new version has to offer.
Since the release has not yet officially happened, we can install the dev release version by running the command:
laravel new laravel55 --dev
cd laravel55
php artisan key:generate
If you prefer not to use the Laravel installer, you can also take the Composer approach:
composer create-project --prefer-dist --stability=dev laravel/laravel:dev-master
cd laravel
php artisan key:generate
Once we visit the homepage of the newly set up app, we should be greeted with a welcome page similar to what we used to have in previous Laravel versions.
I feel this is something that will come in very handy. In the previous Laravel versions, we had to send actual emails or use an email client like Mailtrap to test email layouts, and this wasn't a fun task. This won't be the case any more, as with Laravel 5.5 it's possible to render the email layout to the browser directly.
A quick walkthrough on how to achieve this: let's create a new mailable as well as the email template for our current project:
php artisan make:mail Welcome --markdown=emails.welcome
I prefer the markdown approach since we will get a template with some content already. Let's open our web.php file and create a test route to checkout the email layout:
Route::get('/email', function () {
return new App\Mail\Welcome();
});
routes/web.php
By visiting the route /email we should be able to preview the email template:
What's actually going on under the hood is that with Laravel 5.5, the Mailable class implements the Renderable contract which has a render() method. This is the implementation of the render() method inside lluminate/Mail/Mailable.php:
public function render()
{
Container::getInstance()->call([$this, 'build']);
return Container::getInstance()->make('mailer')->render(
$this->buildView(), $this->buildViewData()
);
}
lluminate/Mail/Mailable.php
This is the method that makes it possible to get a view. Had we tried returning an instance of a class that does not implement the Renderable contract within our routes, we'd get an UnexpectedValueException thrown.
When using Markdown for emails, Laravel will provide a default theme. However, some people may prefer having some custom styling in their email templates for branding purposes.
To use a custom theme for a particular mailable, we first create a custom .css file containing the styles we want:
touch resources/views/vendor/mail/html/themes/custom.css
We then then specify this filename as a property in the Mailable class:
class Welcome extends Mailable
{
protected $theme = 'custom';
[...]
}
app/Mail/Welcome.php
This way, the email layout will be based on the styles we defined in the custom.css file. The good thing with this approach is that we can have different themes for different mailables.
Laravel 5.5 comes with two exception helper functions which will help us write more expressive code. The two helpers are the throw_if and throw_unless methods. Both take three arguments with the third argument being optional.
Let's look at the different implementations of these exceptions:
$number = 2;
throw_if($number !== 3, new NotThreeException('Number is not three'));
// or
throw_if($number !== 3, NotThreeException::class, 'Number is not three');
With the throw_if helper, an exception will be thrown if the first argument evaluates to true.
Implementing the throw_unless helper is no different from what we did above, the only difference being that an exception will only be thrown if the first argument evaluates to false:
$number = 2;
throw_unless($number === 3, new NotThreeException('Number is not three'));
// or
throw_unless($number === 3, NotThreeException::class, 'Number is not three');
Not the best example, but serves our demonstration purposes.
You've probably found yourself in a situation that required you to rebuild the database. With previous Laravel versions, we achieved this by running the php artisan migrate:refresh command. The migrate:refresh command rolls back all migrations based on what is specified in the down method for each migration file then runs the migrations again:
But you've probably run into issues with this command a couple of times, especially when working with foreign key constraints or say you have a down() method in one of your migrations that has not been well defined. When that happens, we resort to dropping the table raising issues manually most of the time - (could be from the CLI or some GUI). That's where migrate:fresh comes to our rescue. This command drops all the tables, then runs the existing migrations again:
Not a really big change but then in previous Laravel versions, we'd see HTML markup from an API client such as Postman every time we got an error while building out APIs. In Laravel 5.5, we get a JSON stack trace rather than HTML markup if an error occurs which looks neater and easier to follow:
These are the steps we follow in order to use a third party package in our Laravel projects.
As you can see, it could be simpler. Now it is.
With automatic package discovery, we'll just require a package and start using it on the fly. Note, however, this only happens if the package provider has configured the package for autodiscovery.
Looking at the Laravel Debugbar package which has already been updated for package autodiscovery, we see that there is an extra section inside the composer.json file:
"extra": {
"laravel": {
"providers": [
"Foo\\Bar\\ServiceProvider"
],
"aliases": {
"Bar": "Foo\\Bar\\Facade"
}
}
}
Package providers will have to update the composer.json file with an extra section, then specify the providers and any aliases for the package.
Another good thing with automatic package discovery is that things won't break after removing a dependency. Normally, even after uninstalling a package we still have the package's service providers and facades hanging around in the config/app.php file and this may raise issues in some cases.
With package autodiscovery, when a package is removed via Composer, then everything related to the package is also removed.
Continue reading %What Are the New Features in Laravel 5.5?%
So what does that phrase mean, "Geo-Targeting WordPress Content"? First, let's back up and look at an example of personalization.
After a decade of steadily declining sales, Coca-Cola turned its fortunes around by simply adding names to Coke bottles. The company’s “Share a Coke” campaign created a personal connection with consumers that fueled sales. After all, why wouldn’t you buy a drink with your name on it?
Nutella soon followed suit, taking the idea a step further by allowing customers to add their own names to jars. Soon enough, people were rushing to show off their personalized jars on social media.
So what do Coca-Cola and Nutella have to do with WordPress?
Well, what these brands achieved are clear examples of the power of personalization. Consumers now expect content online that is unique to them, so much so that 74% of customers feel frustrated when website content is not personalized. And marketers know this – 52% of digital marketers consider the ability to personalize web content to be fundamental to their online strategy. The problem? Only 32% say their CMS enables personalization.
Fortunately, WordPress is not one of these CMSs. There are plenty of tools and plugins for WordPress that make it easy to personalize content for visitors, but by far the easiest way to personalize site content is with geo-targeting.
Geo-targeting is a way for websites to serve specific content to visitors based on their geographic location, usually their country or city via their IP address.
This technique isn’t new – it’s been around so long that it has become ubiquitous. Google provides search results tailored to your location in the world, Amazon offers personalized home pages with recommended products, and eBay displays local currencies.
A more recent example of geo-targeting is WordPress itself. The recent 4.8 release includes a new dashboard widget that displays upcoming WordPress events tailored to your geographic location.
You can use Google Analytics to learn more about your visitors and where they’re from.
Just log in to Google Analytics. Go to Audience > Demographics > Geo > Location.
You’ll see a map of the world color-coded to match your audience demographic and underneath a more detailed breakdown of your audience, including the countries where they are located, sessions, new users, bounce rate, transactions and revenue.
You can use this information to inform how you want to personalize content on your website. For example, based on the geo data in the Google Analytics profile above, you might want to:
Continue reading %Geo-Targeting WordPress Content to Personalize Your Site%