Skip to content

Instantly share code, notes, and snippets.

View olamigokayphils's full-sized avatar

Olamigoke Philip A. olamigokayphils

View GitHub Profile
@olamigokayphils
olamigokayphils / django_logout.py
Created January 31, 2023 09:17
Auto Logout all active Django sessions
import datetime
from django.conf import settings
from django.contrib.auth import logout
from django.contrib.sessions.models import Session
from django.http import HttpRequest
from importlib import import_module
now = datetime.datetime.now()
session_engine = import_module(settings.SESSION_ENGINE)
sessions = Session.objects.filter(expire_date__gt=now)
@olamigokayphils
olamigokayphils / howto
Created December 8, 2020 19:20 — forked from hilkeheremans/howto
Fonts in React Native for Android vs iOS
REACT NATIVE IOS vs ANDROID FONT USE
Tested for React Native 0.41+
IOS:
- Place the fonts in the assets and make sure they are bundled along
- On iOS, fontFamily in Text match the Font Family name as described in Font Book (macOS). Font weights can be specified exactly.
ANDROID:
On Android, there are two ways of using fonts:
@olamigokayphils
olamigokayphils / urls.py
Created November 27, 2020 09:22
Setting up RSS Feed in your Django app
from django.urls import path
from .feeds import LatestEntriesFeed
urlpatterns = [
# ...
path('latest/feed/', LatestEntriesFeed()),
# ...
]
@olamigokayphils
olamigokayphils / feeds.py
Created November 27, 2020 09:20
Setting up RSS Feed in your Django app
from django.contrib.syndication.views import Feed
from django.urls import reverse
from blog.models import BlogPost
class LatestEntriesFeed(Feed):
title = "Blog | Olamigoke Philip"
link = "/feeds/"
description = "I'm Ola; a Full stack web developer. I also ..."
def items(self):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<style>
#intro {
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua and Barbuda
Argentina
Armenia
Australia
Austria
@olamigokayphils
olamigokayphils / Exm.py
Created May 25, 2017 15:35
worked on my first GUI (simple)program.
#
from tkinter import *
class Application(Frame):
"""A updated Version of delete me. """
def __init__(self, master):
super(Application, self).__init__(master)
self.grid()
self.create_widget()