Skip to content

Instantly share code, notes, and snippets.

View Dockerfile
FROM ubuntu:16.04
# Install git and add-apt-repository
RUN apt-get update && apt-get install -y software-properties-common git
# Add repo containing older php versions
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
# Install PHP 5
RUN apt-get update && apt-get install -y graphicsmagick imagemagick php5.6 php5.6-cli \
# Stop all running Docker containers, delete all untagged images, remove all unused volumes
docker stop $(docker ps -a -q) \
&& docker rmi $(docker images -q --filter "dangling=true") --force \
&& docker volume prune --force
alferov /
Last active Mar 31, 2022
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")


alferov /
Last active Dec 21, 2017
SOLID (single responsibility, open-closed, Liskov substitution, interface segregation and dependency inversion) principles
  • Single responsibility principle (SRP): This principle states that software component (function, class or module) should focus on one unique tasks (have only one responsibility).
  • Open/closed principle (OCP): This principle states that software entities should be designed with the application growth (new code) in mind (be open to extension), but the application growth should require the smaller amount of changes to the existing code as possible (be closed for modification).
  • Liskov substitution principle (LSP): This principle states that we should be able to replace a class in a program with another class as long as both classes implement the same interface. After replacing the class no other changes should be required and the program should continue to work as it did originally.
  • Interface segregation principle (ISP): This principle states that we should split interfaces which are very large (general-purpose interfaces) into smaller and more specific ones (many client-specific interfaces) so that
alferov / gist:e01b52d00420e200a727
Last active Oct 26, 2015
Git recursive submodule update
View gist:e01b52d00420e200a727
git submodule update --init --recursive
git submodule foreach --recursive git fetch
git submodule foreach git merge origin master
View gist:4043ece9c5a2fb21a5e1
function checkNested(obj) {
var args =, 1);
for (var i = 0; i < args.length; i++) {
if (!obj || !obj.hasOwnProperty(args[i])) {
return false;
obj = obj[args[i]];
return true;
View 1-highcharts-cheatsheet.js
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download:
// More:
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src=""></script>
// <script src=""></script>