Skip to content

Instantly share code, notes, and snippets.

View srtab's full-sized avatar
🤘
Working hard!

Sandro Rodrigues srtab

🤘
Working hard!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am srtab on github.
  • I am sfrdip (https://keybase.io/sfrdip) on keybase.
  • I have a public key ASABALC2HJ-IUVDZyAv7bwnl3P-lA-X16IwSSw9EYehaMAo

To claim this, I am signing this object:

@srtab
srtab / pyproject.toml
Created January 7, 2020 23:55
Base shared config for flakehell
[tool.flakehell]
format = "colored"
max_line_length = 120
exclude = ["*/migrations/*", "*/static/*", "*/settings/*", "*/node_modules/*"]
max-complexity = 10
import-order = false
# list of plugins and rules for them
[tool.flakehell.plugins]
flake8-bandit = ["+*", "-S101", "-S308", "-S703"]
@srtab
srtab / middleware.py
Last active February 18, 2019 18:56
Django X-Frame-Options to exempt or define same origin to third party applications by view name.
from django.conf import settings
from django.middleware.clickjacking import XFrameOptionsMiddleware as DjangoXFrameOptionsMiddleware
class XFrameOptionsMiddleware(DjangoXFrameOptionsMiddleware):
"""
Wrapper into django.middleware.clickjacking.XFrameOptionsMiddleware to add extra x-frame-options exempt or same
origin by view name.
You can exempt views from third party applications, just define `XFRAME_OPTIONS_EXEMPT_PATTERNS` in your
@srtab
srtab / Dockerfile
Last active February 9, 2019 23:41
Custom Node:10-slim image with google-chrome-stable and node-sass pre-installed
FROM node:10-slim
LABEL maintainer="team@dipcode.com"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
RUN apt-get update -y && \
apt-get install -y \
google-chrome-stable && \
@srtab
srtab / throttle.js
Created May 27, 2015 10:20
Throttle function
function throttle(func, delay) {
var wait = false;
return function () {
if (!wait) {
func.call();
wait = true;
setTimeout(function () {
wait = false;
}, delay);