Skip to content

Instantly share code, notes, and snippets.

View iksi's full-sized avatar
🤞

Jurriaan iksi

🤞
View GitHub Profile
@iksi
iksi / path.js
Created August 6, 2019 07:57
vanilla js functions
// Get deep value from object by passing path to it as an array
const path = (pathArray, nestedObject) => pathArray.reduce((object, key) => (
object && object[key] !== 'undefined' ? object[key] : undefined
), nestedObject);
@iksi
iksi / delete_renditions.py
Created January 7, 2020 15:48
Django management command to delete Wagtail’s image renditions
import os, shutil
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from wagtail.images.models import Rendition
class Command(BaseCommand):
def handle(self, *args, **options):
renditions = Rendition.objects.all()
if renditions:
import React from 'react';
import PropTypes from 'prop-types';
const getSrcUrl = (url, width) => `${url}?w=${width}&fm=jpg&auto=format`;
const getSrcSet = (url, widths) => widths
.map((width) => `${getSrcUrl(url, width)} ${width}w`)
.join(', ');
Pulling docker images...
Creating network "tmp_default" with the default driver
Creating tmp_main_run ...
Creating tmp_main_run ... done
Starting the docker image...
Pulling docker images...
Creating network "tmp_default" with the default driver
Creating tmp_main_run ...
Creating tmp_main_run ... done
Starting the docker image...
export const camelCaseToKebabCase = (string) => {
return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
};