Skip to content

Instantly share code, notes, and snippets.

View diegojancic's full-sized avatar

Diego Jancic diegojancic

View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active November 16, 2024 22:03
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@AndrewJHart
AndrewJHart / jwt_authentication.py
Created April 13, 2016 18:47
JWT authentication middleware for django rest framework that populates the request.user object
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.models import AnonymousUser
from rest_framework.request import Request
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
"""
Replacement for django session auth get_user & auth.get_user for
anonymous
anonymous / ZohoCrmSample.cs
Created August 23, 2012 21:33
Sample C# code to create a lead with the Zoho CRM API.
/*
* Sample C# code to create a lead with the Zoho CRM API.
* ajh 2012-08-23
*/
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Dynamic;
using System.Linq;
using System.Net;