Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
| ;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre]) | |
| (defn with-free-port! | |
| "Attempts to kill any current port-binding process, then repeatedly executes | |
| nullary `bind-port!-fn` (which must return logical true on successful | |
| binding). Returns the function's result when successful, else throws an | |
| exception. *nix only. | |
| This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu." | |
| [port bind-port!-fn & {:keys [max-attempts sleep-ms] |
| <?php | |
| // Get an array of all files in a directory. | |
| $files = File::files('path_to_dir'); | |
| // Get all of the files from the given directory (recursive). | |
| $files = File::allFiles('path_to_dir'); | |
| // Get all of the directories within a given directory. | |
| $files = File::directory('path_to_dir'); |
Single-line comments are started with //. Multi-line comments are started with /* and ended with */.
C# uses braces ({ and }) instead of indentation to organize code into blocks.
If a block is a single line, the braces can be omitted. For example,
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
| # coding: utf-8 | |
| import json | |
| from django import template | |
| from django.utils.dateparse import parse_datetime | |
| from django.utils.html import mark_safe | |
| register = template.Library() |
uninstall JetBrains settings:curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
backup JetBrains settings:curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-backup.sh | bash -s
When a beginner asks you "when do I use semi-colons?" would you rather say this?
// what people who say "use semicolons!!" say
class Foo {
prop = {
}; // yes| # Sample Nginx config with sane caching settings for modern web development | |
| # | |
| # Motivation: | |
| # Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools. | |
| # These tools automatically deactivate all sorts of caching for you, so you always have a fresh | |
| # and juicy version of your assets available. | |
| # At some point, however, you want to show your work to testers, your boss or your client. | |
| # After you implemented and deployed their feedback, they reload the testing page – and report | |
| # the exact same issues as before! What happened? Of course, they did not have developer tools | |
| # open, and of course, they did not empty their caches before navigating to your site. |