Skip to content

Instantly share code, notes, and snippets.

View gcko's full-sized avatar
🇹🇼
Working from 🇹🇼

Jared Scott gcko

🇹🇼
Working from 🇹🇼
View GitHub Profile
@gcko
gcko / sort-by.pipe.ts
Last active January 4, 2021 12:59 — 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`.
/*
*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 August 7, 2023 09:32
Django Custom Model ForeignKey Field for Spanning Databases