Skip to content

Instantly share code, notes, and snippets.

@tylerharper
tylerharper / gist:6185411
Last active December 20, 2015 19:48
django serializer save issue
Django Serializer does not update many 2 many tables nicely with the using paramenter passed into its save. The object itself use the using database, but the many to many objects will not be saved using the using database. Instead it uses some other database.
How does it get that other database?
django/core/serializers/base.py:167:
django/db/models/fields/releated.py:824:
@tylerharper
tylerharper / temp-file.edebug
Created December 18, 2012 02:41
Learning how other create temp file on remote machine. eshell on remote machine tailing a file creates a temp file on remote machine
shell-command("tail bar" #<buffer *eshell remote output*> #<buffer *eshell remote error*>)
eshell-remote-command("tail" ("bar")) <--- really look at this
eshell-external-command("tail" ("bar"))
eshell-plain-command("tail" ("bar"))
eshell-named-command("tail" ("bar"))
Also note tramp-sh-handle-file-local-copy
> df -h
Filesystem Size Used Avail Use% Mounted on
udev 10M 244K 9.8M 3% /dev
/dev/disk/by-uuid/d7e4eb44-ba34-42a7-9cbe-1261536dacde
5.5G 5.1G 192M 97% /
shm 1.5G 0 1.5G 0% /dev/shm
/dev/sda4 119G 73M 112G 1% /boot <---- this line right here
^
|
Do you see it?
class A(object):
x = 1
def __init__(self):
print self.x
self.x = 2
print self.x
a = A()
b = B()
#!/usr/bin/env python
"""
tug - twitter url generator
for now we only support atom feeds
"""
import urllib, urllib2
import sys
= Ruby Packaging Standard
The aim of this document is two-fold. First, to specify a common
structure of how a Ruby package distributed as source (that is, but
not limited to, development directories, version-controlled
repositories, .tar.gz, Gems, ...) should conform to.
Second, to document common and proven ways to structure Ruby packages,
and to point out certain anti-patterns that sneaked into common use.
It is by intent not to innovate.
Hosting Sphinx docs at GitHub
-----------------------------
Before: Run sphinx-quickstart in docs/
1. Follow "Project Pages" instructions from http://pages.github.com/ to create a gh-pages branch
2. Add Sphinx html build dir as git submodule:
git checkout master
git submodule add -b gh-pages git@github.com:arthurk/django-disqus.git docs/_build/html
class CouchObject(object):
'''
Convert between a CouchDB document and Python object.
Create Python objects while maintaining a schema-free database.
Define object properties without storing null fields.
'''
@property
def id(self):
return self._id
- simple
- public over private
- personal vanity
- internet is global
- permalinks
- one important item per page
- don't break the browser
- don't wanker in technology
- a medium is not a grande
- break convention for your users
output = ''
for line in text.split('\n'):
while len(line) > 80:
pos = line[:80].rfind(' ')
output = output + line[:pos] + '\n'
line = line[pos+1:]
output = output + line + '\n'
print output