Skip to content

Instantly share code, notes, and snippets.


Metod Ribič metodribic

  • Working at Better (
  • Slovenia
View GitHub Profile
View atribute_selectors.css
// This attribute exist on the element
// This attribute has a specific value of cool
// This vlaue attribute contains word cool
// This vlaue attribute contains word cool in a space-separated list
View download.ts
async download(image: string) {
const result = await fetch(`data:image/png;base64,${image}`);
const blob = await result.blob();
const a = document.createElement('a');
a.href = URL.createObjectURL(blob); = name;
metodribic / starter.css
Created Sep 2, 2019
Basic css rules for start
View starter.css
body {
max-width: 1100px;
margin: 0 auto;
line-height: 1.5;
color: #2D3748;
strong {
View fonts.css
/* Suitable for wide range of webapps */
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
/* Serifs */
font-family: "MillerDisplay Light", Helvetica, Arial, sans-serif
/* */
font-family: 'Open Sans', sans-serif;
View angular-in-view-directives.html
<!-- wInViewRoot directive is needed to specify the `root` for `IntersectionObserver` and some other it's options e.g. `margin` -->
<div class="container" wInViewRoot="viewport">
Any content can be here
<!-- Content will be replaced by a placeholder <div> with the same height as original content.
Also `InViewItemComponent`s change detector will be detached when it become invisible which means
all the content's change detectors won't be reachable and will be inactive as well. -->
...or any other content can be here
metodribic / copy.js
Created Jan 9, 2019
Copy text to clipboard with pure JavaScript
View copy.js
function copy(text) {
const textarea = document.createElement("textarea"); = '0'; = 'fixed';
textarea.textContent = text;
const body = document.getElementsByTagName('body')[0];
metodribic /
Last active Jul 2, 2020
CSS sibling selectors comparison

Direct children selector >


.a > .b {
  border: 1px solid #eee;
metodribic /
Created Aug 24, 2018
Remove all CR2 (raw image) files if they don't have corresponding JPG sibling
# Remove all CR2 (raw image) files if they don't have corresponding JPG sibling
allJpgs="$(ls|grep .JPG)"
allRaws="$(ls|grep .CR2)"
for file in $allJpgs
metodribic / .htaccess
Created Jun 1, 2018
Apache2 .htaccess for angular2 app hosted in subdirectories
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.html [L]
metodribic / aql.sublime-syntax
Last active Jan 3, 2018
AQL syntax definition for sublime text 3
View aql.sublime-syntax
%YAML 1.2
# See
- aql
scope: source.aql
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
You can’t perform that action at this time.