This is a common case in django ORM.
from django.db import models
class Author(models.Model):
def reltime(date, compare_to=None, at='@'): | |
r'''Takes a datetime and returns a relative representation of the | |
time. | |
:param date: The date to render relatively | |
:param compare_to: what to compare the date to. Defaults to datetime.now() | |
:param at: date/time separator. defaults to "@". "at" is also reasonable. | |
>>> from datetime import datetime, timedelta | |
>>> today = datetime(2050, 9, 2, 15, 00) | |
>>> earlier = datetime(2050, 9, 2, 12) |
Prerequisitie: | |
Ruby 2.0.0-p481 | |
Rails 4.1.6 | |
[Step 1] | |
- rails new wids2015 | |
[Step 2] Add following lines to Gemfile | |
gem 'devise' |
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
--type-add=css=.sass,.less,.scss | |
--type-add=ruby=.rake,.rsel,.builder,.thor | |
--type-add=html=.haml,.html.erb,.html.haml | |
--type-add=js=.js.erb,.coffee | |
--type-set=cucumber=.feature | |
--type-set=c=.c,.cpp,.ino,.pde,.h | |
--ignore-dir=vendor | |
--ignore-dir=log | |
--ignore-dir=tmp | |
--ignore-dir=doc |
// | |
// NSAttributedString+format.m | |
// Chatterbox | |
// | |
// Created by Brent Royal-Gordon on 2/7/14. | |
// Copyright (c) 2014 Architechies. All rights reserved. | |
// | |
#import "NSAttributedString+format.h" |
from collections import OrderedDict as _OrderedDict | |
try: | |
from thread import get_ident as _get_ident | |
except ImportError: | |
from dummy_thread import get_ident as _get_ident | |
class ListDict(_OrderedDict): | |
def __init__(self, *args, **kwds): | |
try: |