Skip to content

Instantly share code, notes, and snippets.

@fjsj
fjsj / gist:92e8687de77917a7c084
Last active August 29, 2015 14:19
Print a properly secure SECRET_KEY in Django. Run this in your terminal.
python -c 'import random; print "".join([random.SystemRandom().choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)])'
@fjsj
fjsj / hn_seach.js
Last active September 21, 2015 14:35 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
total = 0, shown = 0,
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments);
// This traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.className === klass) {
@fjsj
fjsj / has_missing_migrations.py
Last active May 21, 2017 04:51 — forked from nealtodd/gist:a8f87b0d95e73eb482c5
Django management command to detect missing migration files.
import sys
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connections
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from django.db.utils import OperationalError

Keybase proof

I hereby claim:

  • I am fjsj on github.
  • I am fjsj (https://keybase.io/fjsj) on keybase.
  • I have a public key whose fingerprint is F171 C0BF 34E3 858D 39A1 0A5B AC1C 200C F672 6AE0

To claim this, I am signing this object:

@fjsj
fjsj / test-for-tapioca-github.md
Created September 22, 2016 21:32
Test for gileno/tapioca-github

test gist

@fjsj
fjsj / dropzone-createThumbnailFromUrl-ios-fix.js
Created September 29, 2016 18:33
Dropzone monkey patch to fix iOS photo orientation bug
/* Start of monkey patch to fix iOS photo orientation bug.
See: https://github.com/enyo/dropzone/issues/46
Diff here: https://github.com/enyo/dropzone/issues/46#issuecomment-181849181 */
Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback, crossOrigin) {
var img;
img = document.createElement("img");
if (crossOrigin) {
img.crossOrigin = crossOrigin;
}
img.onload = (function(_this) {
@fjsj
fjsj / django-apps-common-structure.txt
Created April 2, 2017 23:02
Django apps common structure
my_app/
management/
migrations/
templates/
templatetags/
__init__.py
admin.py
apps.py
context_processors.py
exceptions.py
@fjsj
fjsj / talk-types.md
Last active March 25, 2024 20:21
PyCon and DjangoCon commonly accepted talk types (with examples)

Tutorial-like

Best/worst practices