Category Archives: Web-Dev

Flexbox responsive columns


<div class="row">
  <div class="col-6 col-sm-12">
    Left column. 50% on large screens. 100% on smaller screens.
  <div class="col-6 col-sm-12 col-right">
    Right column. 50% on large screens. 100% on smaller screens. Has different background for visual difference.


.row {
  display: flex;
  flex-wrap: wrap;

.col-6 {
  flex: 0 0 50%;
  background-color: #eee;

.col-right {
  background-color: #dde;

@media (max-width: 576px) {
  .col-sm-12 {
    flex-basis: 100%;

Web-Dev Notes

DRY is often misinterpreted as the necessity to never repeat the exact same thing twice. This is impractical and usually counterproductive, and can lead to forced abstractions, over-thought and over-engineered code.Harry Roberts

DRY, SRP, Modularity etc is not a ultimate goal or strict rule. It is just a principle and recommendation.


BEM colors:

  • .primary
  • .secondary
  • .tertiary
  • .light
  • .dark

BEM code sample:

<div class="c-card">
  <img class="c-card-img" src="">
  <div class="c-card-header">
  <div class="c-card-body">
    <h4 class="c-card-title">Card title</h4>
    <div class="c-card-text">Card additional content.</div>
    <a href="#" class="button button-primary">Link</a>
  <div class="c-card-footer">
    Posted 12 days ago

Folder structure:

  • components: reusable components. For example: c-pager
  • layout: layout styles, like header, footer, sidebar
  • pages: context specific styles. For example: contact-us
  • utilities: utility helper classes with single function. Often using !important to boost their specificity. For example: u-text-center


Programming Humor

Real Programmers don’t comment their code. If it was hard to write, it should be hard to understand.

Six Stages of Debugging

  1. That can’t happen.
  2. That doesn’t happen on my machine.
  3. That shouldn’t happen.
  4. Why does that happen?
  5. Oh, I see.
  6. How did that ever work?

Add javascript dynamically via javascript

Insert javascript file into document dynamically via javascript:

(function () {
	var script = document.createElement('script');
	script.type = 'text/javascript';
    script.src = '';
	// document.body.appendChild(script);
	}, 5000);

Add stylesheet dynamically via javascript

Insert CSS file into document dynamically via javascript:

(function () {
	var styles = document.createElement('link');
	styles.rel = 'stylesheet';
	styles.type = 'text/css';
	styles.href = '';
	document.body.classList.add('animated', 'infinite', 'shake');

Debugging the issue

Try to isolate the issue. Copy the code that you have issues with and paste it into the clean page template.

Can you still reproduce the issue? If no – than you are missing some code from the main template. If you still can reproduce the issue than continue reading.

Now you need to start removing parts that you think are irrelevant. You should remove parts one by one with fairly small pieces of code. Refresh the page after each code remove and check if you still can reproduce the issue.

Can you still reproduce the issue? If yes – try to remove the next piece of code. If no – bring the last removed piece of code (with Ctrl+Z or what ever hot key is in your laptop). Now you found the piece of code where the issue might be. This should give you a clue to locate the issue and ways to fix it.

image placeholder


&lt;img src=""&gt;


Holder.js – works offline, uses svg


<img data-src="holder.js/256x113?bg=#b4e6ca&amp;fg=#90b8a1" alt="256x113" src="data:image/svg+xml;charset=UTF-8," data-holder-rendered="true">