Skip to content

Instantly share code, notes, and snippets.

View seun-beta's full-sized avatar
🔥
Building & Learning

Seunfunmi Adegoke seun-beta

🔥
Building & Learning
View GitHub Profile
@rg3915
rg3915 / django_orm_optimization_cheat_sheet.py
Last active August 26, 2023 15:51 — forked from levidyrek/django_orm_optimization_cheat_sheet.py
Django ORM optimization cheat sheet
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@yershalom
yershalom / get_commit_count.py
Created December 17, 2017 13:19
Easy way to calculate commits count from the github api
import requests
base_url = 'https://api.github.com'
def get_all_commits_count(owner, repo, sha):
first_commit = get_first_commit(owner, repo)
compare_url = '{}/repos/{}/{}/compare/{}...{}'.format(base_url, owner, repo, first_commit, sha)
commit_req = requests.get(compare_url)