Skip to content

Instantly share code, notes, and snippets.

$ ssh dev.example.com cat /etc/apache2/sites-available/git.example.com
<VirtualHost *:80>
ServerName git.example.com
DocumentRoot /usr/share/gitweb
<Directory /usr/share/gitweb>
Options FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
</Directory>
CREATE TEMPORARY TABLE foo_staging LIKE FOO;
-- replace with bulk insert if you like
\copy into foo_staging [...]
INSERT INTO foo
SELECT
foo_staging.*
FROM
foo_staging
LEFT JOIN foo USING (key, columns, here)
repo @all
config hooks.jenkins-url = http://builds.example.com/
config hooks.base-url = git@git.example.com:
config hooks.repository-root = /var/lib/gitolite3/repositories
:)owen@dashie:Development$ git init pyc-problem
Initialized empty Git repository in /Users/owen/Development/pyc-problem/.git/
:)owen@dashie:Development$ cd pyc-problem/
:)owen@dashie:pyc-problem (master #)$ echo 'value = "before"' > foo.py
:)owen@dashie:pyc-problem (master #)$ cat > script <<'SCRIPT'
> #!/usr/bin/env python
>
def jsonizable(atoms=(), lists=(), objects=()):
"""Adds a `to_json` method to decorated classes:
>>> @jsonizable(atoms=['name', 'age'])
... class Example(object):
... def __init__(self, name, age):
... self.name = name
... self.age = age
...
>>> e = Example('bob', 37)
:)owen@dashie:surprise$ git init
Initialized empty Git repository in /Users/owen/Development/FreshBooks/schemata/surprise/.git/
:)owen@dashie:surprise (master #)$ git fetch git://github.com/idcmp/pyd.git master
remote: Counting objects: 379, done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 379 (delta 192), reused 324 (delta 140)
Receiving objects: 100% (379/379), 65.66 KiB | 31 KiB/s, done.
Resolving deltas: 100% (192/192), done.
From git://github.com/idcmp/pyd
@ojacobson
ojacobson / Clock.java
Created November 27, 2012 02:41 — forked from azuby/Job.java
public class Model {
JSONClient clientFactory;
private final String resource;
protected Model(String resource, Activity activity) {
this.resource = resource;
clientFactory = new JSONClient(activity);
}
def jsonizable(atoms=(), lists=(), objects=()):
"""Adds a `to_json` method to decorated classes:
>>> @jsonizable(atoms=['name', 'age'])
... class Example(object):
... def __init__(self, name, age):
... self.name = name
... self.age = age
...
>>> e = Example('bob', 37)
You can, additionally, overlay values or computed values onto the JSON
representation by passing the optional `overlay` parameter as a dictionary
of callables:

    >>> @jsonizable(atoms=['name'])
    ... class Person(object):
    ...     def __init__(self, name):
    ...         self.name = name
    ... 

>>> @jsonizable(lists=['students'], objects=['teacher'])

def jsonizable(atoms=(), lists=(), objects=()):
"""Adds a `to_json` method to decorated classes:
>>> @jsonizable(atoms=['name', 'age'])
... class Example(object):
... def __init__(self, name, age):
... self.name = name
... self.age = age
...
>>> e = Example('bob', 37)