Laravel Uptime Monitor
Read more at https://www.phpclasses.org/package/11764-PHP-Monitor-servers-to-verify-if-they-are-responding.html#2020-08-16-08:10:56
A popular refrain in object-oriented code is to favor object composition over inheritance. It offers more flexibility, less overhead, and ends up being easier to reason about. The same concept applies to functions, too!
A common pattern is to have a function that does some work and then calls another function, which does some work and calls another function, and so on. The problem is that the first function then cannot be used or tested without the entire chain of other functions it calls. This is the function equivalent of "inheritance."
Instead, we can compose functions, that is, pipe them together. Instead, take the output of the first function and pass it to the second, then take the second's output and pass it to the third, etc. That way, each of the functions can be reused, tested, and understood in isolation, then we can stick them together like LEGO blocks to build whatever series of steps we want.
That is, instead of this:
<?php
function A($in)
{
// ...
return B($out);
}
function
B($in)
{
// ...
return C($out);
}
function
C($in)
{
// ...
return $out;
}
?>
Structure it like this:
<?php
function A($in)
{
// ...
return $out;
}
function
B($in)
{
// ...
return $out;
}
function
C($in)
{
// ...
return $out;
}
function
doit($in) {
$out = A($in);
$out = B($out);
$out = C($out);
return $out;
}
?>
Now `A()`, `B()`, and `C()` are all easier to read, understand, and test, and we can more easily add a step B2 or D if we want. So powerful is this concept that many languages have a native operator for piping functions together like that. PHP doesn't, yet, but it's straightforward enough to do in user space anyway.
Want to know more about functional programming and PHP? Read the whole book on the topic: Thinking Functionally in PHP.
Noted – Use this Figma plugin to take simple notes within the app.
Optimizing CSS for faster page loads – Techniques behind improving the performance of your CSS.
Fast – An adaptive interface system for modern web experiences.
Magnetic Buttons – Learn how to build a set of buttons with some fun hover animations.
Embracing Competency and Letting Go of Design Perfection – By nature, none of us are perfect. That’s why the real beauty is in being a competent designer.
Drop-Shadow: The Underrated CSS Filter – A look at the unique features of the CSS drop-shadow
filter.
The UX of LEGO Interface Panels – What can LEGO teach us about design?
Ten modern layouts in one line of CSS – Yes, you read that correctly. These layout examples require only a single line!
10 Free Professional Adobe InDesign Resume Templates – Use one of these beautiful resume templates to grab the attention of prospective employers.
Rando.js – Easily create random JavaScript functions with this tiny script.
neuicons – Download this free, crisp collection of over 1,000 icons.
When Does Using Headless WordPress Make Sense? – Headless WordPress allows you to push content to a variety of places. But is it right for your project?
Hexpalette – Looking for color ideas? You’ll find tons of great options here.
Papercups – An open source customer messaging system for use on your projects.
Advice for Beginners That Are Starting Out in Web Design – Whether you want a professional career or to pick up a new hobby, there’s something here for you.
Styled Components: A Quick Start Guide – Get started with the popular library for React and React Native.
pophurdle – A free, lightweight popup blocker extension for Google Chrome.
The post Weekly News for Designers № 553 appeared first on Speckyboy Design Magazine.
There are many scripts that recursively execute php -l on a set of files or directories. This is mine:
#!/usr/bin/env bash set -o nounset # Recursively call `php -l` over the specified directories/files if [ -z "$1" ] ; then printf 'Usage: %s...\n' "$(basename "$0")" exit 1 fi ERROR=false SAVEIFS=$IFS IFS=$'\n' while test $# -gt 0; do CURRENT=${1%/} shift if [ ! -f $CURRENT ] && [ ! -d $CURRENT ] ; then echo "$CURRENT cannot be found" ERROR=true continue fi for FILE in $(find $CURRENT -type f -name "*.php") ; do OUTPUT=$(php -l "$FILE" 2> /dev/null) # Remove blank lines from the `php -l` output OUTPUT=$(echo -e "$OUTPUT" | awk 'NF') if [ "$OUTPUT" != "No syntax errors detected in $FILE" ] ; then echo -e "$FILE:" echo -e " ${OUTPUT//$'\n'/\\n }\n" ERROR=true fi done done IFS=$SAVEIFS if [ "$ERROR" = true ] ; then exit 1 fi echo "No syntax errors found." exit 0
I store it in ~/bin and usually run it like this:
$ cd project $ phplint . No syntax errors found.
There are a few interesting bash tricks that I picked up when I wrote this.
Firstly, you need to set IFS to break on new line rather than space otherwise the find command doesn't work with spaces in file names.
I also discovered that the output of php -l has quite a lot of blank lines in its output that I didn't want. OUTPUT=$(echo -e "$OUTPUT" | awk 'NF') solves this nicely.
I also wanted to indent the output and used bash's parameter expansion system to replace a new line with a new line and two spaces using ${OUTPUT//$'\n'/\\n }
Maybe you'll find this useful or it'll work as the basis for a script you need to write.
I’m going to talk about something controversial today. Everyone strap in and brace yourselves. Freelance designers like to encourage newbies entering the industry to learn as many skills as they can to make themselves attractive as a job candidate. This is well-meaning advice that undoubtedly comes from a good place.
But generally speaking, these ‘generalists’ who try to design, code, write copy, take photographs, do SEO, and anything else they think their clients might need with an equal amount of success are inferior to design specialists in every way.
Today, we’re going to look at why that is, and what freelance designers can do instead to boost their desirability to potential clients.
You can’t do everything. And pretending that you can is just a waste of time. You have to be honest about your abilities and stick to what you’re really good at.
Multitasking usually only lowers your overall performance. Sure, you might get hired, but if it quickly becomes apparent that you have no idea what you’re doing, you’ll be found out and most likely out of work.
For example, It’s very hard to find someone who can do both visual design and coding extremely well, not to mention copywriting or photography, which are their own separate skills that people study individually for years before mastering. Usually one suffers and there is a noticeable disparity in quality.
Regardless of popular opinion, multitasking can actually be damaging to both your productivity and your career success. If you’re too busy with your hands in too many pots on the stove, you’ll never have time to focus in on the one thing that can propel you ahead of your competition.
I’m not saying that you need to do one thing and one thing only (that would be hypocritical of me, being both a designer and a writer). But remember that potential clients often have more peace of mind – not less – when they see that you have years of experience focusing in on a single area.
Many people are afraid that their niche isn’t going to be big enough to sustain their business. But that’s complete bunk (usually – I’ll get to the exception in a minute). Even products and services you might think are completely ridiculous and no one would ever be looking for have gone on to become million dollar businesses.
A certain type of beanbag chair, an album of nothing but songs about sailing, even specialty olives for making dirty martinis – all of these ideas have made their owners a lot of money and earned them a die hard fanbase of people who were looking for just what they were selling.
People will come seek you out for that one, particular, special thing that you’re the absolute best at. For the movie Coraline, the producers hired a woman to make tiny knit sweaters for the stop motion dolls used in filming… and that was all. Seriously, that was all she was hired to do. That’s all she does, period.
If that lady can make a tidy living knitting little sweaters, you can rest assured that your niche, whatever it is, can allow you to soar within the design world.
I’ll end with a caveat that may seem counter-intuitive to everything I’ve just said, even though it really isn’t. Be careful not to get “too” specialized – that is, catering to a niche that’s too specific and that will never yield you the kind of results you need to truly grow your freelancing business.
Specialists have a tendency to die off if their skills are no longer needed. Just like in the wild, if a sudden disease kills off the single food source of a specialist, well, those specialists won’t be around much longer.
So make sure you zero in on something universal and that will have evergreen appeal, rather than focusing on a particular technology or method of information exchange (e.g. copywriting for tech industry startups rather than copywriting for Facebook ads).
The post You’ll Never Be a Design Specialist by Generalizing Your Skills appeared first on Speckyboy Design Magazine.