This is a common case in django ORM.
from django.db import models
class Author(models.Model):
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# Two very basic functions for searching just the input code of an IPython notebook | |
# Written because I often want to search notebooks for snippets but the giant output | |
# of embedded encoded images makes it difficult. | |
# Ipython's nbconvert can be used to extract just the input, but this requires | |
# writing to a separate file and can be quite slow when used with large notebooks. | |
# Additionally, find/xargs can be used with igrep when the name of the notebook isn't known. | |
# icat could be used to convert an IPython notebook to a standard python file if | |
# the notebook does not contain whole-cell magics. |
(10/30/2016) I am not sure when and how this gist gained quite a few stars... But as stated in the v1.13 change log (from 06/16/2015): some content may be outdated, and I am not going to fix them. Moreover, having learned much myself, I do not necessarily agree with every point made in this document from 2.5 years ago. Therefore, please take views from this document with a grain of salt, and do further research as you see fit.
This document was initally written for a friend of mine, Jiawen Li, so it might reflect some personal tastes here and there. For instance, some discussions are geared towards Windows, though *nix is obviously superior. For another example, when I say "you seem to love Sublime Text a lot," I'm certainly not expecting most people to love Sublime (in fact I never used it for more than three minutes in a row).
This document is written in Markdown. The Markdown rendering engine on GitHub Gist is somewhat limited a
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
""" | |
traits_ndarray | |
-------------- | |
I was taking the IPython.utils.traitlets for a spin; | |
the only really useful thing missing was an NDArray | |
which validates on certain shape and type constraints | |
and notifies for interesting kinds of inequalities | |
id(x)==id(y), (x==y).all(), allclose(x, y). |
For ETS's SKLL project, we found out the hard way that Travis-CI's support for numpy and scipy is pretty abysmal. There are pre-installed versions of numpy for some versions of Python, but those are seriously out of date, and scipy is not there are at all. The two most popular approaches for working around this are to (1) build everything from scratch, or (2) use apt-get to install more recent (but still out of date) versions of numpy and scipy. Both of these approaches lead to longer build times, and with the second approach, you still don't have the most recent versions of anything. To circumvent these issues, we've switched to using Miniconda (Anaconda's lightweight cousin) to install everything.
A template for installing a simple Python package that relies on numpy and scipy using Miniconda is provided below. Since it's a common s