Skip to content

Instantly share code, notes, and snippets.

@muneneevans
muneneevans / README
Created August 12, 2021 08:46 — forked from bjb/README
sample django program: include model info into a form(set) without requiring edits to the model. Useful for a formset that allows performing an action on any of several models.
run ./unpack.sh to create the django directory structure.
make a virtualenv using requirements.txt and enter it.
run ./manage.py syncdb to create databases (sqlite3 by default).
Now you can run the app with ./manage.py runserver
To push back to gist, run ./pack.sh to copy the changed
files to where gist expects to find them, and commit
as usual.
Please update unpack.sh and pack.sh if you add/remove files.
@muneneevans
muneneevans / countries.csv
Created September 8, 2021 05:11 — forked from zspine/countries.csv
Country Code, ISO and Nationality ( Please use https://mledoze.github.io/countries/ )
CCA2 Name CCA3 Nationality
AD Andorra AND Andorran
AE United Arab Emirates ARE Emirati
AF Afghanistan AFG Afghan
AG Antigua and Barbuda ATG Antiguan, Barbudan
AI Anguilla AIA Anguillian
AL Albania ALB Albanian
AM Armenia ARM Armenian
AN Netherlands Antilles ANT Dutch
AO Angola AGO Angolan
@muneneevans
muneneevans / README.md
Created September 13, 2021 10:03 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@muneneevans
muneneevans / settings.py
Created January 28, 2022 11:56 — forked from ipmb/settings.py
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGGING_CONFIG = None
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
logging.config.dictConfig({
@muneneevans
muneneevans / custom-entity-not-found-exception-filter.md
Created July 27, 2022 08:46 — forked from gsusmonzon/custom-entity-not-found-exception-filter.md
Make NestJs returns 404 when EntityNotFoundError exception is thrown

Make NestJs returns 404 when EntityNotFoundError exception is thrown

When using findOrFail() or findOneOrFail() from typeORM, a 500 error is returned if there is no entity (EntityNotFoundError).

To make it returns a 404, use an exception filter as described in https://docs.nestjs.com/exception-filters .

file /src/filters/entity-not-found-exception.filter.ts

@muneneevans
muneneevans / auth.ts
Created September 7, 2022 11:28 — forked from acabreragnz/auth.ts
Authentication in Nestjs using JWT and Local strategires
# src/api/auth/passport/jwt.strategy.ts
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { ConfigService } from 'src/api/config/config.service';
import { UsersProvider } from 'src/api/users/users.provider';
import { JwtService } from '@nestjs/jwt';
@Injectable()