This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
from django.db import models | |
from django.core.exceptions import ValidationError | |
class ConstraintModel(models.Model): | |
class Meta: | |
abstract = True | |
def _fill_constraints_register(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- returns and update the next value for a named ticket. | |
CREATE OR REPLACE FUNCTION get_ticket(ticket_name varchar(50)) RETURNS INTEGER AS $$ | |
DECLARE | |
ticket INTEGER; -- | |
BEGIN | |
IF EXISTS (SELECT * FROM ticketing_ticket WHERE name = ticket_name FOR UPDATE) THEN | |
UPDATE ticketing_ticket SET currval = currval + incval | |
WHERE name = ticket_name RETURNING currval INTO ticket; -- | |
RETURN ticket; -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Boot multiple live-cds from a USB | |
## | |
# First install grub on the usb, for example: | |
# | |
# $ sudo grub-install --no-floppy --force --root-directory=/media/E310-C779 /dev/sdc1 | |
# Get some of the isos you want to boot | |
# | |
# $ ls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage | |
from pipeline.storage import PipelineMixin | |
from functools import wraps | |
import shutil | |
import re | |
import subprocess | |
def coroutine(func): | |
@wraps(func) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
from optparse import make_option | |
from django.core.management.commands.runserver import BaseRunserverCommand | |
from django.conf import settings | |
class Command(BaseRunserverCommand): | |
option_list = BaseRunserverCommand.option_list + ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
site_name: C1.com.bo | |
description: C1 | |
keywords: design, bolivia | |
build_dir: htdocs | |
apps: | |
blog: | |
handler: constructor.handlers.BlogHandler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
hg diff --stat -r $HG_NODE -r tip | |
BRANCH=$(hg log --template '{branches}' -r $HG_NODE) | |
if [ "$BRANCH" == "release" ] ; then | |
hg update --clean release >&2 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from project import api | |
from .resources import UserResource | |
api.resources.register(UserResource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As http://developer.ubuntu.com/get-started/gomobile/ says | |
sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper | |
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa | |
sudo apt-get update | |
sudo apt-get install ubuntu-sdk notepad-qml | |
# On ubuntu 12.04 qmake 3 is set as the default alternative for qmake, | |
# I was no able to start correctly the qt-designer, so I search the | |
# qmake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load after jquery.js | |
// Instead of $('#my_input').val(), do $('#my_input').trimmed_val() | |
(function() { | |
String.prototype.trim = function(){return this.replace(/^\s+|\s+$/g, '');}; | |
String.prototype.ltrim = function(){return this.replace(/^\s+/,'');}; | |
String.prototype.rtrim = function(){return this.replace(/\s+$/,'');}; | |