Serhat Teker

Serhat Teker is the software engineer who wrote these articles.

I created this Tech Blog to help me remember the things I’ve learned in the past, so my future-self doesn’t have to re-learn them in the future.

               

‘Big O’ in Python with decorator

2019-06-08 — 3 minutes read
#python  #dunder  #decorator 
We sometimes —always?, want to know how efficient our code is. So here comes the magical Big O notation: Big O notation is used in computer science to describe the performance or complexity of an algorithm. Actually Big O notation is special symbol that tells you how fast an algorithm is. Of course you’ll use predefined algorithms often — and when you do, it’s vital to understand how fast or slow they are.

Django Template - {{ block.super }}

2019-06-01 — 3 minutes read
#django  #python  #template  #html  #xml 
Django Templates A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, etc.). A template contains variables, which get replaced with values when the template is evaluated, and tags, which control the logic of the template. Below is a minimal template that illustrates a few basics. {% extends "base_generic.html" %}{% block title %}{{ section.title }}{% endblock %}{% block content %}<h1>{{ section.title }}</h1> {% for story in story_list %}<h2> <a href="{{ story.

Vim fzf - Project Root

2019-05-18 — 2 minutes read
#vim  #neovim  #fzf  #golang 
What is fzf? fzf is a general-purpose command-line fuzzy finder written in Go. fzf is a fuzzy finder for your terminal, it is a command line application that filters each line from given input with a query that the user types. When the query changes, the results update in realtime. Vim Since I spend a lot of my time in Vim trying to find a file either by name or by some code inside a certain file.

Django Environment Variables

2019-04-13 — 2 minutes read
#django  #python  #environment 
If you look at modern code deployment practices, like in the 12 factor app, environment variables are very important for keeping secret information, or specific information set for a server. All while not having long settings in a settings file —files, or every single server and host. It helps keep things simple and clean in your code along with the following quoted from the 12factorapp site: Resource handles to the database, Memcached, and other backing services Credentials to external services such as Amazon S3 or Twitter Per-deploy values such as the canonical hostname for the deploy What Are Environment Variables?

Django Login Middleware

2019-02-24 — 2 minutes read
#django  #python  #middleware 
Django provides a decorator called login_required that takes one of your views and prevents a user from seeing it unless they are authenticated. Every time we need to add this decorator above view. Usually it’s a real pain to use the login_required decorator all over the views of your sophisticated site. What if you forget to add it to view that contains sensitive information? Django allows you to write custom middleware that gets access to each request so you can add functionality that can be applied to your whole site.