Skip to content

Instantly share code, notes, and snippets.

Avatar

Pratyush Mittal pratyushmittal

View GitHub Profile
@pratyushmittal
pratyushmittal / README.md
Last active November 15, 2022 09:12
Using Django ChangeList in custom views
View README.md

Using Django's changelist feature in custom views

Django has a fabulous ChangeList feature. It is used to show lists in admin. It also provides:

  1. Search bar
  2. Date Hierarchy filters
  3. Other filters in sidebar (including option to define custom filters)
  4. Handles pagination
@pratyushmittal
pratyushmittal / .env
Last active September 7, 2022 07:04
A SwiftBar script to show unread emails in menu-bar
View .env
EMAIL_ID=foobar@gmail.com
PASSWORD=your-app-password
@pratyushmittal
pratyushmittal / justfile
Created July 31, 2022 13:43
I like to manually mark each line as checked during code reviews. This script allows that. Blog post about it: https://fully-faltoo.com/p/reviewing-each-line-of-code/
View justfile
default:
just --list
review:
#!/usr/bin/env bash
cd {{invocation_directory()}}
source_branch_name=$(git branch --show-current)
review_branch_name=review-${source_branch_name}
git merge main
@pratyushmittal
pratyushmittal / block.js
Created June 25, 2015 07:00
AngularJS - Adding content outside ng-view
View block.js
function block($document) {
function blockLink(scope, elem, attrs) {
var element = elem[0];
element.removeAttribute('block');
element.removeAttribute('target');
var targetTag = 'block-' + attrs.target;
var blockElem = angular.element($document).find(targetTag)[0];
blockElem.innerHTML = '';
blockElem.appendChild(element);
scope.$on('$destroy', function() {