Skip to content

Instantly share code, notes, and snippets.

View pydanny's full-sized avatar

Daniel Roy Greenfeld pydanny

View GitHub Profile
@pydanny
pydanny / awesome_cbv.py
Created November 27, 2011 23:30
My awesome CBV form fix
class CrazyViewWithTwoForms(DetailView):
def post(self, request, *args, **kwargs):
# mock the GET action in a post request.
# Doesn't need to do anything but this.
# Is boilerplate but works.
# Clearly designed by and for smart people. ;)
return self.get(request, *args, **kwargs)
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@ptone
ptone / current.md
Created October 6, 2012 04:25
A WIP refactor of auth docs - this is just a draft rough reorg - much rewriting would also be involved
  • /topics/auth.txt
    • Overview
    • Installation
    • Users
      • API reference
        • Fields
        • Methods
        • Manager functions
      • Basic usage
  • Creating users
\renewcommand{\linebreak}{\HCode{<br>}}
% This is for rendering a .tex file using tex4ht, which renders the output as HTML.
% \renewcommand{\linebreak} tells LaTeX to overwrite the default command.
% {\HCode{<br>}} says to put in a HTML <br> tag

========= =========== =============== ============= City Country Date Status ========= =========== =============== ============= Ship Atlantic April 20-May 1 Done! Barcelona Spain May 01-09 Done! Warsaw Poland May 09-24 Done! Krakow Poland May 24 Done! Dynow Poland May 25-28 Done! Krakow Poland May 24-June 10 Done! Florence Italy June 10-June 21 Done

@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
Storing files in a database field should never happen. If it's being considered as a solution
to a problem, find a certified database expert and ask for a second opinion.
\bigskip
To summarize PostgreSQL expert Frank Wiles on the problems with using a database as a filestore:
\begin{itemize}
\item `read/write to a DB is always slower than a filesystem'
\item `your DB backups grow to be huge and more time consuming'
\item `access to the files now requires going through your app (Django) and DB layers'
# -*- coding: utf-8 -*-
# test_docstrings.py
import pytest
def test_lambdas():
# Create a lambda and test it
doubler = lambda x: " ".join([x, x])
assert doubler("fun") == "fun fun"
# Add a docstring to the lambda
@pydanny
pydanny / test_fun_with_partials.py
Last active January 26, 2018 10:07
In order to run this script, you'll need to have both py.test and six installed.
# -*- coding: utf-8 -*-
# In order to run this script, you'll need to
# have both py.test and six installed.
# Assuming you have pip, in a virtualenv just
# type at the command-line:
#
# pip install pytest six
#
# To run it, just type:
#
@pydanny
pydanny / shortcut.go
Last active August 29, 2015 14:01
Does anyone else do this? Or is this a bad thing?
package main
import (
"fmt"
)
func main() {
var p = fmt.Println
p("I don't want to type fmt.Println.")