Skip to content

Instantly share code, notes, and snippets.

View romantomjak's full-sized avatar

Roman Tomjak romantomjak

View GitHub Profile
@SeanHayes
SeanHayes / settings.py
Created January 6, 2010 01:31
Test Settings/Test Database in Django
#normal settings.py stuff should go above this comment
#if manage.py test was called, use test settings
if 'test' in sys.argv:
try:
from test_settings import *
except ImportError:
pass
@stefanfoulis
stefanfoulis / osx_developer_installation.rst
Last active July 10, 2024 14:36
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Brew User

@sr75
sr75 / wildcard-ssl-cert-for-testing-nginx-conf.md
Created June 1, 2013 18:35
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
@woloski
woloski / auth0.py
Last active June 14, 2017 21:12
this shows a very simple bare bones example of authenticating with Auth0 using standard python libraries
import webapp2
import urllib2
import urllib
import json
## CHANGE THIS
CLIENT_ID = "vYPeq7LGf1utg2dbDlGKCwGKgy94lPH0"
CLIENT_SECRET = "DLQ5dWkNMwPlUWo2jqVkbG1PFyeMvV60HEJaW0FioeI4ZxGaAW73BiqRBZmRk29v"
DOMAIN = "contoso.auth0.com"
CALLBACK_URL = "http://localhost:8080/callback"
@mattseymour
mattseymour / django-secret-keygen.py
Last active September 8, 2022 23:47
Django secret key generator
"""
Pseudo-random django secret key generator.
- Does print SECRET key to terminal which can be seen as unsafe.
"""
import string
import random
from __future__ import print_function
@turowicz
turowicz / swift-json-class.md
Last active February 21, 2017 07:00
Apple Swift strong type object serialization to JSON
@lauris
lauris / markov.py
Last active February 6, 2018 15:21
Markov Chains
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
import string
import re
from collections import Counter
@lavie
lavie / delete_stale_images.sh
Last active April 24, 2017 23:57
Free disk space by deleting "stale" docker images (keep around the latest N tags of each image)
#!/bin/bash
images=$(./stale_image_tags.sh my.repo 3)
for image in $images; do
docker rmi $image
done
@F1LT3R
F1LT3R / xhr-monitor.js
Created July 30, 2015 19:08
xhr progress monitor javascript
var oldXHR = window.XMLHttpRequest;
var xhr_errors = 0;
var xhr_loads = 0;
var xhr_aborts = 0;
var xhrStack = {};
var xhr_count = 0;
function newXHR() {
@paulirish
paulirish / what-forces-layout.md
Last active July 22, 2024 06:32
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent