Skip to content

Instantly share code, notes, and snippets.

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 \
@alferov
alferov / docker-cleanup.md
Last active October 19, 2017 23:53
Docker cleanup
# 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
alferov / docker-rm-images.md
Last active July 24, 2023 08:33
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")

References:

@alferov
alferov / solid.md
Last active December 21, 2017 10:01
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
alferov / esnextbin.md
Last active March 30, 2016 03:05
esnextbin sketch
@alferov
alferov / gist:e01b52d00420e200a727
Last active October 26, 2015 23:32
Git recursive submodule update
git submodule update --init --recursive
git submodule foreach --recursive git fetch
git submodule foreach git merge origin master
@alferov
alferov / gist:4043ece9c5a2fb21a5e1
Last active August 29, 2015 14:24
checkNested
function checkNested(obj) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < args.length; i++) {
if (!obj || !obj.hasOwnProperty(args[i])) {
return false;
}
obj = obj[args[i]];
}
return true;
}
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download: http://www.highcharts.com/download
// More: http://api.highcharts.com/highcharts
// 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="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// <script src="https://code.highcharts.com/highcharts.js"></script>