-
This is a numbered list.
-
I'm going to include a fenced code block as part of this bullet:
Code More Code
# Rake tasks for managing git plugins with submodules. | |
# | |
# These tasks aim to make life simpler by automating all the boring work. | |
# What you get: | |
# - complete git integration (all you need to know is install, uninstall and update) | |
# - complete github integration (only use author name + plugin name) | |
# - rails plugin hooks (install.rb/uninstall.rb) are taken care of | |
# | |
# Available commands: | |
# |
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
camera = {} | |
camera._x = 0 | |
camera._y = 0 | |
camera.scaleX = 1 | |
camera.scaleY = 1 | |
camera.rotation = 0 | |
function camera:set() | |
love.graphics.push() | |
love.graphics.rotate(-self.rotation) |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
def runserver(port=5000, profile_log=None): | |
"""Runs a development server.""" | |
from gevent.wsgi import WSGIServer | |
from werkzeug.serving import run_with_reloader | |
from werkzeug.debug import DebuggedApplication | |
from werkzeug.contrib.profiler import ProfilerMiddleware | |
port = int(port) | |
if profile_log: |
(This gist is pretty old; I've written up my current approach to the Pyramid integration on this blog post, but that blog post doesn't go into the transactional management, so you may still find this useful.)
I've created a Pyramid scaffold which integrates Alembic, a migration tool, with the standard SQLAlchemy scaffold. (It also configures the Mako template system, because I prefer Mako.)
I am also using PostgreSQL for my database. PostgreSQL supports nested transactions. This means I can setup the tables at the beginning of the test session, then start a transaction before each test happens and roll it back after the test; in turn, this means my tests operate in the same environment I expect to use in production, but they are also fast.
I based my approach on [sontek's blog post](http://sontek.net/blog/
-- Authored by tanakh | |
{-# LANGUAGE TupleSections #-} | |
import Control.Applicative | |
import Control.Monad | |
import Data.List | |
import Text.Printf | |
main :: IO () | |
main = do |
There are two JSON API styles:
- The ID Style
- The URL Style
The ID style is the easiest to get started with, but requires that your clients be able to guess the URLs for related documents. It also locks your API into a particular URL structure, which may become a problem as your API grows.
The URL style requires less guessing on the client side, and makes clients more resilient to API changes, but is trickier to use with relationships and compound documents.