Skip to content

Instantly share code, notes, and snippets.

View maliMirkec's full-sized avatar
🤘
I’m really good at this without realising how.

Silvestar Bistrović maliMirkec

🤘
I’m really good at this without realising how.
View GitHub Profile
@maliMirkec
maliMirkec / ssh
Created April 10, 2017 08:59
Update ssh port
# replace 22 with desired port number, save and exit
mcedit /etc/ssh/sshd_config
# restart ssh service
service ssh restart
# go to vestacp admin, firewall and edit ssh port
@maliMirkec
maliMirkec / replace-placeholders.js
Created March 29, 2017 15:22
JavaScript function for replacing template placeholders.
var t = function (s, d) {
for (var p in d)
s = s.replace(new RegExp('{' + p + '}', 'g'), d[p]);
return s;
};
// usage
t('<p>{label1}</p><p>{label2}</p>', {
label1: 'Value1'
})
@maliMirkec
maliMirkec / documentation and installation
Last active February 2, 2018 19:08
Batch scripts for image optimization
http://www.tecmint.com/optimize-and-compress-jpeg-or-png-batch-images-linux-commandline/
https://blarg.co.uk/blog/recursively-optimize-png-files
# install jpegoptim
apt-get update
apt-get install jpegoptim
# install optipng
apt-get update
apt-get install optipng
@maliMirkec
maliMirkec / .jshintrc
Created February 10, 2017 11:10
Default JSHint config
{
"maxerr" : 50,
"bitwise" : false,
"camelcase" : true,
"curly" : true,
"eqeqeq" : true,
"forin" : true,
"freeze" : true,
"immed" : false,
"latedef" : false,
@maliMirkec
maliMirkec / .editorconfig
Created February 8, 2017 09:50
.editorconfig for FE projects
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
@maliMirkec
maliMirkec / style.scss
Last active July 9, 2017 16:37
Default starting point when defining new style
@mixin css-locks($properties, $min-vw, $max-vw, $min-value, $max-value) {
@each $property in $properties {
#{$property}: $min-value;
}
@media screen and (min-width: $min-vw) {
@each $property in $properties {
#{$property}: calc(#{$min-value} + #{strip-unit($max-value - $min-value)} * (100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)});
}
}
@maliMirkec
maliMirkec / fonts.css
Created February 7, 2017 13:19
Default OS fonts
html {
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
}
@maliMirkec
maliMirkec / locks.scss
Last active July 9, 2017 16:37
Document typography with css locks
@mixin css-locks($properties, $min-vw, $max-vw, $min-value, $max-value) {
@each $property in $properties {
#{$property}: $min-value;
}
@media screen and (min-width: $min-vw) {
@each $property in $properties {
#{$property}: calc(#{$min-value} + #{strip-unit($max-value - $min-value)} * (100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)});
}
}
@maliMirkec
maliMirkec / reset.css
Created February 7, 2017 13:18
Simple CSS reset
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
@maliMirkec
maliMirkec / solution_task001.js
Last active February 3, 2022 06:39
codility tasks
// you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
// 80%
function binary(N) {
var half = Math.floor(N / 2);
var r = (N % 2).toString();
if(N >= 2) {