Skip to content

Instantly share code, notes, and snippets.

View happygrizzly's full-sized avatar
🐻

Aleksey Filippov happygrizzly

🐻
View GitHub Profile
@belgattitude
belgattitude / how-to-docker-mssql-docker-compose.md
Last active February 24, 2025 23:00
Example of mssql/server:2022-CU16-ubuntu-22.04 docker compose with healthcheck

Docker mssql server

Features

  • Recent mssql server version (server:2022-CU16-ubuntu-22.04 with mysql-tools-18)
  • Healthcheck

Requirements

  • Docker engine > 2.7
@lucianoratamero
lucianoratamero / README.md
Last active April 5, 2025 05:47
Using Vite with Django, the simple way

Using Vite with Django, the simple way

Warning

I'm surely not maintaining this as well as I could. There are also other possible, better integrated solutions, like django-vite, so keep in mind this was supposed to be more of a note to myself than anything :]

This gist has most of the things I've used to develop the frontend using vite inside a monolithic django app.

Here's a boilerplate that uses this approach: https://github.com/labcodes/django-react-boilerplate

A couple of things to note:

@zerolab
zerolab / responsiveimage_tags.py
Created June 20, 2019 09:55
Wagtail responsive image tag
from django import template
from wagtail.images.models import SourceImageIOError
from wagtail.images.shortcuts import get_rendition_or_not_found
from wagtail.images.templatetags.wagtailimages_tags import ImageNode
register = template.Library()
@register.tag(name="responsiveimage")
@VincentLoy
VincentLoy / breadcrumb.jinja
Last active June 19, 2024 16:52
Easy snippet to get breadcrumb in a Wagtail page
<div class="breadcrumb-content">
{% if self.get_ancestors|length > 1 %}
<ul class="breadcrumb">
{% for p in self.get_ancestors %}
{% if p.is_root == False %}
<li><a href="{{ p.url }}">{{ p.title }}</a></li>
{% endif %}
{% endfor %}
<li class="active">{{ self.title }}</li>
@DejanBelic
DejanBelic / async await ie11.js
Last active May 11, 2023 15:09
How to use async await in ie11
// Async await func
async function getTimelineData() {
var response = await fetch('/some-api-url')
return response.json()
}
async function populateTimelineInit() {
var data = await getTimelineData();
new vis.DataSet(data);
@tobiase
tobiase / responsive_image.py
Created April 25, 2018 23:30 — forked from davecranwell/responsive_image.py
Responsive image tag for Wagtail CMS
from django import template
from django.template import Context
from django.template.base import parse_bits
from wagtail.wagtailimages.templatetags.wagtailimages_tags import ImageNode
from wagtail.wagtailimages.models import Filter, SourceImageIOError, InvalidFilterSpecError
from britishswimming.utils.models import SocialMediaSettings
register = template.Library()
@magnetikonline
magnetikonline / README.md
Last active January 1, 2023 22:00
Extract all files at every commit of a Git repository.

Extract all files at every commit of a Git repository

Bash script to iterate all commits of a given Git repository and extract all files within each commit.

Example

With a Git repository at /path/to/repository and an empty directory at /path/to/output we can run:

./export.sh /path/to/repository /path/to/output
@stalniy
stalniy / abilities.js
Created January 5, 2018 20:58
CASL Vue routes
import { AbilityBuilder, Ability } from 'casl'
// Alternatively this data can be retrieved from server
export default function defineAbilitiesFor(user) {
const { rules, can } = AbilityBuilder.extract()
can('read', 'User')
can('update', 'User', { id: user.id })
if (user.role === 'doctor') {
@seanpianka
seanpianka / generate_hex_string.py
Last active August 18, 2023 21:07
Generate a random hex string/key in Python 3
def generate_hex_string(length: int):
""" Generate a randomized hex string.
Parameters
----------
length : int
Desired character length of the returned token.
Returns
-------
public class ArchiveContentFinder : IContentFinder
{
public bool TryFindContent(PublishedContentRequest contentRequest)
{
var path = contentRequest.Uri.GetAbsolutePathDecoded();
var db = ApplicationContext.Current.DatabaseContext.Database;
var archived = db.SingleOrDefault<Archive>("select * from archive where Url = @0 or Url = @1", path, path + "/");