This file contains 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
const std::map<std::string, std::string> fromQMap(const QMap<QString, QString> &q_map) | |
{ | |
std::map<std::string, std::string> std_map; | |
QMap<QString, QString>::const_iterator i = q_map.constBegin(); | |
while (i != q_map.constEnd()) { | |
std_map.insert(std::pair<std::string, std::string>(i.key().toStdString(), i.value().toStdString())); | |
} | |
return std_map; | |
} |
This file contains 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
const std::vector<std::string> fromQVector(const QVector<QString> &qVect) | |
{ | |
std::vector<std::string> stdVect; | |
for (int i = 0; i < qVect.size(); ++i) { | |
stdVect.push_back(qVect[i].toStdString()); | |
} | |
return stdVect; | |
} | |
const std::map<std::string, std::string> Aria2c::fromQMap(const QMap<QString, QString> &qMap) |
This file contains 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
__author__ = 'alireza' | |
import re | |
import datetime | |
f = open('/home/alireza/countries.sql') | |
matches = re.findall(r"'([A-Z]{0,2})','([A-Z,. \"\(\)\-]+)','([\w\\,. \"\(\)\-]+)','?([A-Z]{0,4})'?,'?([\w]{0,4})'?", | |
f.read()) |
This file contains 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
def forwards(self, orm): | |
""" | |
Slugify all the country.printable_name and put them in slug field | |
""" | |
from django.template.defaultfilters import slugify | |
for country in orm.Country.objects.all(): | |
country.slug = slugify(country.printable_name) | |
countey.save() | |
This file contains 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
Traceback (most recent call last): | |
File "manage.py", line 14, in <module> | |
execute_manager(settings) | |
File "~/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager | |
utility.execute() | |
File "~/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute | |
self.fetch_command(subcommand).run_from_argv(self.argv) | |
File "~/venv/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv | |
self.execute(*args, **options.__dict__) | |
File "~/venv/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute |
This file contains 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
def onPreSave(sender, **kwargs): | |
import logging as logger | |
model_instance = kwargs['instance'] | |
logger.debug('before the changes is like this') | |
from django.core import serializers | |
logger.warning(serializers.serialize('json', [model_instance,], indent=4)) | |
logger.warning("==============") | |
logger.warning("pre_save done ;)") | |
logger.warning("==============") |
This file contains 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
def onPreSave(sender, **kwargs): | |
import logging as logger | |
model_instance = kwargs['instance'] | |
logger.debug('before the changes is like this') | |
from django.core import serializers | |
logger.warning(serializers.serialize('json', [model_instance,], indent=4)) | |
logger.warning("==============") | |
logger.warning("pre_save done ;)") | |
logger.warning("==============") | |
This file contains 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
adminSection = modules.AppList() | |
if CuserMiddleware.get_user().is_superuser: | |
adminSection = modules.AppList( | |
title="Adminstration", | |
models=('django.contrib.*',) | |
) | |
self.children.append(modules.Group( | |
title="Sections", |
This file contains 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
django.jQuery("input").click(function(){ | |
alert("clicked"); | |
}); |
This file contains 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
$(function(){ | |
$("input").click(function(){ | |
alert("clicked"); | |
}); | |
}); |