Guard clause

A Guard Clause (one of the SmalltalkBestPracticePatterns, and equally applicable in a whole bunch of languages) is a chunk of code at the top of a function (or block) that serves a similar purpose to a Precondition.

It typically does one (or any or all) of the following:

  • checks the passed-in parameters, and returns with an error if they’re not suitable.
  • checks the state of the object, and bails out if the function call is inappropriate.
  • checks for trivial cases, and gets rid of them quickly.

For example:

draw() {
  if (! isVisible()) return;

// without Guard Clause
function getPayAmount() {
  let result;
  if (isDead)
    result = deadAmount();
  else {
    if (isSeparated)
      result = separatedAmount();
    else {
      if (isRetired)
        result = retiredAmount();
        result = normalPayAmount();
  return result;

// with Guard Clause
function getPayAmount() {
  if (isDead) return deadAmount();
  if (isSeparated) return separatedAmount();
  if (isRetired) return retiredAmount();
  return normalPayAmount();


It is easy to find out that you are tired physically if you are running. You can rest a little and you will feel when are ready to run again. It is very easy to miss the moment when you already burnout.

Burnout symptoms

  • Irritable
  • Indifferent
  • Not motivated
  • Still tired after weekend or vacation
  • Senselessness of life

Burnout compensation

People are searching for compensation of missing pleasure from work.

  • Social media (chaotic browsing on facebook, youtube etc)
  • Shopoholism
  • Extreme sport
  • Gaming addiction
  • Excessive eating (especially heavy on sugar processed food)
  • Cofee
  • Netflix
  • Alcoholism
  • Drugs addiction
  • And surprise: overtimes at the same work

You need to check if any of the activity you are doing still gives you pleasure or it is just a habit. If you don’t receive pleasure from one of those activities anymore then you need to stop doing it for some period of time.

Burnout stages (by Matthias Burisch)

1. Warning Phase

Excessive participation:

  • excessive activity;
  • rejection of needs not related to work;
  • restriction of social contacts;


  • Depletion; feeling tired;
  • insomnia;
  • the threat of accidents;

2. Decrease in own participation

In relation to employees or clients:

  • loss of positive perception of colleagues;
  • transition from help to supervision and control;
  • attributing blame for one’s own failures to other people;
  • the dominance of stereotypes in behavior towards employees and clients; The manifestation of inhumane approach to people.

In relation to the others:

  • lack of empathy;
  • indifference;
  • cynical evaluation;

In relation to professional activities:

  • unwillingness to perform their duties;
  • artificial extension of breaks in work, late arrival, leaving work ahead of time;
  • emphasis on the material aspect while simultaneously dissatisfied with the work;

Increasing requirements:

  • loss of a vital ideal, concentration on own needs;
  • feeling that other people are using you;
  • envy;

3. Emotional reactions


  • constant guilt, reduced self-esteem;
  • groundless fears, lability of mood, apathy;


  • defenses, blaming others, ignoring their participation in failures;
  • lack of tolerance and ability to compromise;
  • suspicion, conflicts with the environment;

4. Phase of destructive behavior

Intelligence area:

  • reduced concentration, lack of ability to perform complex tasks;
  • rigidity of thinking, lack of imagination;

Motivational area:

  • lack of own initiative;
  • reduced efficiency;
  • performance of tasks strictly according to the instructions;

Emotional-social area:

  • indifference, avoidance of informal contacts;
  • lack of participation in the lives of other people or excessive attachment to a specific person;
  • avoidance of work related topics;
  • self-sufficiency, loneliness, rejection of a hobby, boredom;

5. Psychosomatic reactions and reduced immunity

  • inability to relax during free time;
  • insomnia, sexual dysfunction;
  • increased pressure, tachycardia, headaches;
  • back pain, indigestion;
  • addiction to nicotine, caffeine, alcohol;

6. Disappointment and negative life attitude;

  • a sense of helplessness and meaninglessness of life;
  • existential despair;

Burnout treatment

  • Work 40 hours per week at most. Try to reduce this amount as much as possible.
  • Travel more
  • Do not work outside of working hours

Burnout facts

  • Routine цwork is boring and does not lead to burnout.
  • The most involved people burnout first.

5 hormones of happiness

  1. Dopamine – you need a good rest and find a new target.
  2. Adrenaline – periodically participate in any exciting activities: bungee jumping, some quests, etc.
  3. Serotonin – fresh air, walks, sleep, healthy food, physical activity.
  4. Endorphin – physical exercises, sex.
  5. Oxytocin – meeting with old colleagues, friends.

The best way is to balance all of those hormones.
In real life it works differently. During interesting project you got a lot of Dopamine and it become exciting. However, the sensitivity of dopamine receptors decreases – the body adapts. At this point, we either begin to work harder, trying to “catch up” with the pleasure that has gone. Or we begin to compensate for its activities that bring dopamine faster and easier (facebook, coffee, shopping, alcohol).


Responsive Image

	<source srcset="img-mobile.jpg" media="(max-width: 767px)">
	<source srcset="img-tablet.jpg" media="(min-width: 768px) and (max-width: 991px)">
	<source srcset="img-desktop.jpg" media="(min-width: 992px) and (max-width: 1200px)">
	<source srcset="img-widescreen.jpg" media="(min-width: 1201px)">

	<img src="img-desktop.jpg" />


CSS Responsive Table

JSFiddle Demo.


<table class="table-stacked">
      <th>First Name</th>
      <th>Last Name</th>
      <td data-th="#">1</td>
      <td data-th="First Name">Brenda</td>
      <td data-th="Last Name">Bear</td>

      <td data-th="#">2</td>
      <td data-th="First Name">Frank</td>
      <td data-th="Last Name">Fox</td>

      <td data-th="#">3</td>
      <td data-th="First Name">William</td>
      <td data-th="Last Name">Wolf</td>


.table-stacked {
  width: 100%;

.table-stacked thead tr {
  border-bottom: 1px solid gray;

@media (max-width: 768px) {
  .table-stacked thead {
    display: none;
  .table-stacked td {
    display: flex;
    border-color: gray;
  .table-stacked td:before {
    content: attr(data-th);
    font-weight: bold;
    width: 30%;
    min-width: 80px;
    padding: 10px;
    padding-left: 0;
    margin: -10px 10px;
    margin-left: 0;
    border-right: 1px solid gray;
    border-width: 2px;
  .table-stacked td:last-child {
    border-bottom: 1px solid gray;
    border-color: gray;

How to Win Friends and Influence People Summary

How to Win Friends and Influence People: The Principles

Part 1: Fundamental Techniques in Handling People

  1. Principle 1: Don’t criticize, condemn or complain
  2. Principle 2: Give honest and sincere appreciation
  3. Principle 3: Arouse in the other person an eager want

Part 2: Six Ways to Make People Like You

  1. Principle 1: Become genuinely interested in other people
  2. Principle 2: Smile
  3. Principle 3: Remember that a person’s name is to that person the sweetest and most important sound in any language
  4. Principle 4: Be a good listener
  5. Principle 5: Talk in terms of the other person’s interests
  6. Principle 6: Make the other person feel important—and do it sincerely

Part 3: How to Win People to Your Way of Thinking

  1. Principle 1: The only way to get the best of an argument is to avoid it
  2. Principle 2: Show respect for the other person’s opinions. Never say, “You’re wrong.”
  3. Principle 3: If you are wrong, admit it quickly and emphatically
  4. Principle 4: Begin in a friendly way
  5. Principle 5: Get the other person saying, “yes, yes” immediately
  6. Principle 6: Let the other person do a great deal of the talking
  7. Principle 7: Let the other person feel that the idea is his or hers
  8. Principle 8: Try honestly to see things from the other person’s point of view
  9. Principle 9: Be sympathetic with the other person’s ideas and desires
  10. Principle 10: Appeal to the nobler motives
  11. Principle 11: Dramatize your ideas
  12. Principle 12: Throw down a challenge

Part 4: Be a Leader—How to Change People Without Giving Offense or Rousing Resentment

  1. Principle 1: Begin with praise and honest appreciation
  2. Principle 2: Call attention to people’s mistakes indirectly
  3. Principle 3: Talk about your own mistakes before criticizing the other person
  4. Principle 4: Ask questions instead of giving direct orders
  5. Principle 5: Let the other person save face
  6. Principle 6: Praise the slightest improvement and praise every improvement. Be “hearty in your approbation and lavish in your praise.”
  7. Principle 7: Give the other person a fine reputation to live up to
  8. Principle 8: Use encouragement. Make the fault seem easy to correct
  9. Principle 9: Make the other person happy about doing the thing you suggest

How to Win Friends and Influence People Summary

Ninety-nine times out of a hundred, people don’t criticize themselves for anything, no matter how wrong it may be.

Criticism is futile because it puts us on the defensive and usually makes us strive to justify ourselves. Criticism is dangerous, because it wounds our pride, hurts our sense of importance, and arouses resentment.

Don’t criticize others; they are just what we would be under similar circumstances.

“Don’t complain about the snow on your neighbor’s roof when your own doorstep is unclean.”—Confucius

We’re not logical; we’re emotional, motivated by pride and vanity.

“I will speak ill of no man and speak all the good I know of everybody.”—Benjamin Franklin

Rather than condemn others, try to understand them. Try to figure out why they do what they do.

We all want to be appreciated.

“I consider my ability to arouse enthusiasm among my people. The greatest asset I possess and t way to develop the best that is in a person is by appreciation and encouragement.”—Charles Schwab

Before trying to persuade someone to do something, ask yourself, “How can I make this person want to do it?”

“If there is any one secret of success it lies in the ability to get the other person’s point of view and see things from that person’s angle as well as from your own.”—Henry Ford

“You can make more friends in two months by becoming interested in other people than you can in two years by trying to get other people interested in you.”

“It is the individual who is not interested in his fellow men who has the greatest difficulties in life and provides the greatest injury to others. It is from among such individuals that all human failures spring.”  

Encourage others to talk about themselves.

Always make the others feel important.

Most people you meet will feel superior to you in some way. A sure way to their hearts is to let them realize in some subtle way that you recognize their importance, and recognize it sincerely.

“Talk to people about themselves and they will listen for hours.”—Disraeli

“If you argue and rankle and contradict, you may achieve a victory sometimes; but it will be an empty victory because you will never get your opponent’s good will.”

How to keep a disagreement from becoming an argument:

  1. Welcome the disagreement
  2. Distrust your first instinctive impression
  3. Control your temper
  4. Listen first
  5. Look for areas of agreement
  6. Be honest
  7. Promise to think over your opponents’ ideas and study them carefully
  8. Thank your opponents sincerely for their interest
  9. Postpone action to give both sides time to think through the problem

“There’s magic, positive magic, in such phrases as: ‘I may be wrong. I frequently am. Let’s examine the facts.’”

“Don’t argue with your customer or your spouse or your adversary. Don’t tell them they are wrong. Don’t get them stirred up. Use a little diplomacy.”

“If we know we are going to be rebuked anyhow, isn’t it far better to beat the other person to it and do it ourselves?”

“Say about yourself all the derogatory things you know the other person is thinking or wants to say or intends to say—and say them before that person has a chance to say them.”

When you’re right, try to win people gently and tactfully to your way of thinking. When you’re wrong, admit your mistakes quickly and with enthusiasm.

“In talking with people, don’t begin by discussing the things on which you differ. Begin by emphasizing—and keep on emphasizing—the things on which you agree. Keep emphasizing, if possible, that you are both striving for the same end and that your only difference is one of method and not of purpose. Get the other person saying, ‘Yes, yes’ at the outset. Keep your opponent, if possible, from saying ‘No.’”

“Remember that other people may be totally wrong. But they don’t think so. Don’t condemn them. Any fool can do that. Try to understand them. Only wise, tolerant, exceptional people even try to do that”

“If, as a result of reading this book, you get only one thing—an increased tendency to think always in terms of the other person’s point of view, and see things from that person’s angle as well as your own—if you get only that one thing from this book, it may easily prove to be one of the stepping—stones of your career.”

How to stop arguments, eliminate ill feeling, create good will, and make the other person listen attentively: “I don’t blame you one iota for feeling as you do. If I were you I would undoubtedly feel just as you do.”

“Three-fourths of the people you will ever meet are hungering and thirsting for sympathy. Give it to them, and they will love you.”

It’s always easier to listen to unpleasant things after we have heard some praise of our good points.

“Calling attention to one’s mistakes indirectly works wonders with sensitive people who may resent bitterly any direct criticism.”

“It isn’t nearly so difficult to listen to a recital of your faults if the person criticizing begins by humbly admitting that he, too, is far from impeccable.”

“Admitting one’s own mistakes—even when one hasn’t corrected them—can help convince somebody to change his behavior.”

“People are more likely to accept an order if they have had a part in the decision that caused the order to be issued.”

“Everybody likes to be praised, but when praise is specific, it comes across as sincere—not something the other person may be saying just to make one feel good.”

“If you want to improve a person in a certain aspect, act as though that particular trait were already one of his or her outstanding characteristics.”

“Tell your child, your spouse, or your employee that he or she is stupid or dumb at a certain thing, has no gift for it and is doing it all wrong, and you have destroyed almost every incentive to try to improve. But use the opposite technique—be liberal with your encouragement, make the thing seem easy to do, let the other person know that you have faith in his ability to do it, that he has an undeveloped flair for it—and he will practice until the dawn comes in the window in order to excel.”

“Always make the other person happy about doing the thing you suggest.”

The effective leader should keep the following guidelines in mind when it is necessary to change attitudes or behavior:   

  1. Do not promise anything that you cannot deliver. Forget about the benefits to yourself and concentrate on the benefits to the other person
  2. Know exactly what it is you want the other person to do
  3. Ask yourself what is it the other person really wants
  4. Consider the benefits that person will receive from doing what you suggest
  5. Match those benefits to the other person’s wants
  6. When you make your request, put it in a form that will convey to the other person the idea that he personally will benefit