Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Working from 🇹🇼

Jared Scott gcko

:shipit:
Working from 🇹🇼
View GitHub Profile
@gcko
gcko / sort-by.pipe.ts
Last active Jan 4, 2021 — forked from mdmoin7/sort-by.pipe.ts
This is a fork of https://gist.github.com/mdmoin7/13828acc95b3bf6c32eb98b9e7a6c581 that fixes the issue where the `value` will not be sorted if `caseInsensitive = false`.
View sort-by.pipe.ts
/*
*ngFor="let c of oneDimArray | sortBy:true/false:'asc'"
*ngFor="let c of arrayOfObjects | sortBy:true/false:'asc':'propertyName'"
*/
import { Pipe, PipeTransform } from '@angular/core';
import { orderBy, sortBy } from 'lodash-es';
@Pipe({ name: 'sortBy' })
export class SortByPipe implements PipeTransform {
transform<T>(
@gcko
gcko / related.py
Last active Mar 26, 2021
Django Custom Model ForeignKey Field for Spanning Databases
View related.py