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
#!/usr/bin/env python | |
import os | |
import zipfile | |
""" | |
Helper class that lets one add whole directory contents. | |
License | |
-------------------- |
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
#!/usr/bin/env python | |
import os | |
import zipfile | |
""" | |
Helper class that lets one add whole directory contents. | |
License | |
-------------------- |
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
export PIP_DOWNLOAD_CACHE=/var/lib/jenkins/pip-cache | |
export AQUIPAGO_ENVIRONMENT=testing | |
make | |
env/bin/pip install -r requirements/base.txt --download-cache=/var/lib/jenkins/pip-cache --use-mirrors --timeout 1 | |
env/bin/pip install -r requirements/project.txt --download-cache=/var/lib/jenkins/pip-cache --use-mirrors --timeout 1 | |
env/bin/python runtests.py || : | |
env/bin/pylint --rcfile=.pylintrc aquipago --ignore=test > reports/pylint.txt || : |
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
# Start the old vagrant | |
$ vagrant init centos-6.3 | |
$ vagrant up | |
# You should see a message like: | |
# [default] The guest additions on this VM do not match the install version of | |
# VirtualBox! This may cause things such as forwarded ports, shared | |
# folders, and more to not work properly. If any of those things fail on | |
# this machine, please update the guest additions and repackage the | |
# box. |
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
// REQUIRED: Include "jQuery Query Parser" plugin here or before this point: | |
// https://github.com/mattsnider/jquery-plugin-query-parser | |
$(document).ready(function(){ | |
// BOOTSTRAP 3.0 - Open YouTube Video Dynamicaly in Modal Window | |
// Modal Window for dynamically opening videos | |
$('a[href^="http://www.youtube.com"]').on('click', function(e){ | |
// Store the query string variables and values | |
// Uses "jQuery Query Parser" plugin, to allow for various URL formats (could have extra parameters) |
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
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). | |
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and | |
# run `sudo service procps start` or reboot. | |
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit | |
# | |
# More information resources: | |
# -$ man inotify # manpage | |
# -$ man sysctl.conf # manpage | |
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use |
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
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled. | |
Using the code from twitter bootstrap documentation page, this code is customized for table header. | |
Create the table with following layout - | |
<table class="table-fixed-header"> | |
<thead class="header"> | |
<tr> | |
<th>Column 1</th> | |
<th>Column 2</th> | |
<th>Column 3</th> |
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
============== | |
git commands | |
============== | |
To rename branch | |
================= | |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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 AbstractClassWithoutFieldsNamed(cls, *excl): | |
""" | |
Removes unwanted fields from abstract base classes. | |
Usage:: | |
>>> from oscar.apps.address.abstract_models import AbstractBillingAddress | |
>>> from koe.meta import AbstractClassWithoutFieldsNamed as without | |
>>> class BillingAddress(without(AbstractBillingAddress, 'phone_number')): | |
... pass |
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
from django.db import models | |
from django.db.models import Manager | |
from django.db.models.query import QuerySet | |
class CaseInsensitiveQuerySet(QuerySet): | |
def _filter_or_exclude(self, mapper, *args, **kwargs): | |
# 'name' is a field in your Model whose lookups you want case-insensitive by default | |
if 'name' in kwargs: | |
kwargs['name__iexact'] = kwargs['name'] | |
del kwargs['name'] |
OlderNewer