Skip to content

Instantly share code, notes, and snippets.

Michael Floering hangtwenty

Block or report user

Report or block hangtwenty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hangtwenty
hangtwenty / fix_typo_for_django_cached_template_loader.md
Last active Dec 5, 2019
TypeError: __init__() missing 1 required positional argument: 'loaders'
View fix_typo_for_django_cached_template_loader.md

Django's Cached Template Loader

Quick tip on fixing an error that may confuse you. Namely, because in the settings file, we have to give string names - so errors are somewhat abstracted from your input.

Basically, when you give the argument to TEMPLATES["OPTIONS"]["loaders"],

  • the argument is a list of loaders;
  • for the cached loader, the first argument is the cached loader,
  • but it needs 1+ args - what it's caching.
  • You pass this as a tuple of the loader, and its args.
@hangtwenty
hangtwenty / README.md
Last active Nov 6, 2019
Quick note - how to fix django-livereload-server import error. https://github.com/tjwalch/django-livereload-server
View README.md

Error:

ImportError: cannot import name 'livereload_port' from 'livereload'

Cause:

You have both livereload and django-livereload-server installed. Most likely, one was installed before the other, and having both is an accident.

@hangtwenty
hangtwenty / README.md
Created Nov 6, 2019
Quick note - how to fix django-livereload import error
View README.md

Error:

ImportError: cannot import name 'livereload_port' from 'livereload'

Cause:

You have both livereload and django-livereload installed. Most likely, one was installed before the other, and having both is an accident.

@hangtwenty
hangtwenty / README.md
Created Nov 6, 2019
Quick note - how to fix django-livereload import error
View README.md

Error:

ImportError: cannot import name 'livereload_port' from 'livereload'

Cause:

You have both livereload and django-livereload installed. Most likely, one was installed before the other, and having both is an accident.

@hangtwenty
hangtwenty / README.md
Created Nov 6, 2019
Quick note - how to fix django-livereload import error
View README.md

Error:

ImportError: cannot import name 'livereload_port' from 'livereload'

Cause:

You have both livereload and django-livereload installed. Most likely, one was installed before the other, and having both is an accident.

View aligning-images.md

Aligning images

left alignment

This is the code you need to align images to the left:

<img align="left" width="100" height="100" src="http://www.fillmurray.com/100/100">
@hangtwenty
hangtwenty / stash_dropped.md
Last active Oct 9, 2019 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?
View stash_dropped.md

How to recover a dropped stash in Git?

1. Find the stash commits:

git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@hangtwenty
hangtwenty / python_test_impact_analysis.md
Last active Mar 28, 2019
Note on Python TIA (Test Impact Analysis)
View python_test_impact_analysis.md

Question:

What could I try for doing Test Impact Analysis for Python projects?

Answer:

There are a few libraries out there you could try. Here are some entrypoints:

@hangtwenty
hangtwenty / continuous_learning_inflection_point.md
Last active Mar 11, 2019
blog draft: continuous learning is the keystone habit of software development. oh, and the other part: you have to get over yourself!
View continuous_learning_inflection_point.md

I've self-educated as a developer; now almost 10 years into it, it's worked out for me. But why? What was the deciding factor?

Looking back, I think I can see the inflection point.

I had a mentor who helped me use interactive approaches, and test-driven development. This led to a test-driven mindset.

The core of this mindset is the empirical attitude: that you can know nothing without testing. I learned to iterate in a more directed way. And by always beginning with failing tests,

@hangtwenty
hangtwenty / _preserve_ipython_history_TLDR.diff
Last active Apr 18, 2019
preserve ipython history between docker-compose runs (for local/development usage). diff is only approximately two lines
View _preserve_ipython_history_TLDR.diff
diff --git a/local.yml b/local.yml
index b587373..73684bf 100644
--- a/local.yml
+++ b/local.yml
@@ -3,6 +3,7 @@ version: '2'
volumes:
#...
+ ipython_data_local: {}
services:
You can’t perform that action at this time.