Skip to content

Instantly share code, notes, and snippets.

@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()
@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 / 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 / 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 / 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
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 / Dockerfile
Created August 11, 2021 19:49 — forked from nolram/Dockerfile
Docker-compose: Django + Postgis + RabbitMQ + Celery + Redis
FROM python:3.5
MAINTAINER Marlon Baptista de Quadros(marlonbaptista@hotmail.com)
ENV PYTHONUNBUFFERED 1
RUN apt-get update -y
RUN apt-get -y install binutils libproj-dev gdal-bin postgresql-client python3-lxml
RUN apt-get -y install libmemcached-dev
@muneneevans
muneneevans / Confetti.tsx
Created August 6, 2021 09:26 — forked from ShopifyEng/Confetti.tsx
Building Arrive's Confetti in React Native with Reanimated - Confetti Final
import React, {useMemo} from 'react'
import Animated from 'react-native-reanimated'
import {View, Dimensions, StyleSheet} from 'react-native'
import FastImage from 'react-native-fast-image'
import ConfettiImage from 'assets/images/confetti.png'
const NUM_CONFETTI = 100
const COLORS = ['#00e4b2', '#09aec5', '#107ed5']
const CONFETTI_SIZE = 16
import AsyncStorage from '@react-native-async-storage/async-storage';
import {reactotronRedux} from 'reactotron-redux';
import {NativeModules} from 'react-native';
let scriptHostname;
let reactotron = {};
if (__DEV__) {
const Reactotron = require('reactotron-react-native').default; // eslint-disable-line global-require
const scriptURL = NativeModules.SourceCode.scriptURL;
scriptHostname = scriptURL.split('://')[1].split(':')[0];
@muneneevans
muneneevans / DOCKER_COMPOSE.md
Created June 5, 2021 11:53 — forked from GabrielCzar/DOCKER_COMPOSE.md
Docker compose samples

Scripts to run specific services