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
| konsolex=$(qdbus | grep konsole | cut -f 2 -d\ ) | |
| if [ -n konsolex ]; then | |
| for konsole in $konsolex | |
| do | |
| xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `qdbus $konsole /konsole/MainWindow_1 winId`; | |
| done | |
| fi | |
| if [ `qdbus | grep yakuake` ]; then | |
| xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -name Yakuake; | |
| 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
| /* | |
| * String.split(delimiter,limit) | |
| * Override Internet Explorer implementation of String.split to handle regular | |
| * expression capture groups in the same manner as all other browsers. Each | |
| * capture group in the matched text will be included in the split array. | |
| */ | |
| if("a'b".split(/(')/g).length==2){ | |
| String.prototype.split = function(delimiter/*,limit*/){ | |
| if(typeof(delimiter)=="undefined"){ | |
| return [this]; |
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 python | |
| # -*- coding: utf-8 -*- | |
| from django import template | |
| from django.utils.safestring import mark_safe | |
| import re | |
| register = template.Library() | |
| @register.filter(name='highlight') |
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
| class YourForm(forms.Form): | |
| ... | |
| def clean_field(self): | |
| data = self.cleaned_data['field'] | |
| if not data: | |
| data = self.instance.field | |
| return data |
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
| export PS1="\[$(tput bold)\]\[$(tput setaf 4)\][\[$(tput setaf 6)\]\u\[$(tput setaf 6)\]@\[$(tput setaf 6)\]\h \[$(tput setaf 1)\]\W\[$(tput setaf 4)\]]\\$ \[$(tput sgr0)\]" |
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
| # edit your .bashrc | |
| nano ${HOME}/.bashrc | |
| if [ ! -d "${HOME}/.pip-packages" ]; then | |
| mkdir ${HOME}/.pip-packages | |
| fi | |
| alias pipcache='pip install --download ${HOME}/.pip-packages' | |
| alias pipinstall='pip install --no-index --find-links=file://${HOME}/.pip-packages/' |
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.db import models | |
| class Person(models.Model): | |
| _first_name = models.CharField(max_length=30, db_column='first_name') | |
| last_name = models.CharField(max_length=30) | |
| @property | |
| def first_name(self): | |
| """your logic here, return value""" | |
| return "foo" |
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
| class SiteDetectionMiddleware: | |
| def process_request(self, request): | |
| settings.SITE_ID = 1 | |
| host = request.META.get('HTTP_HOST') | |
| if host: | |
| try: | |
| site = Site.objects.get(domain=host) | |
| settings.SITE_ID = site.id |
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
| $('div.modal').on('show.bs.modal', function(e){ | |
| var carousel = $(this).find('.carousel').hide(); | |
| var deferreds = []; | |
| var imgs = $('.carousel', this).find('img'); | |
| imgs.each(function(){ | |
| var self = $(this); | |
| var datasrc = self.attr('data-src'); | |
| if (datasrc) { | |
| var d = $.Deferred(); |
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
| var isMobile = { | |
| Android: function() { | |
| return navigator.userAgent.match(/Android/i); | |
| }, | |
| BlackBerry: function() { | |
| return navigator.userAgent.match(/BlackBerry/i); | |
| }, | |
| iOS: function() { | |
| return navigator.userAgent.match(/iPhone|iPad|iPod/i); | |
| }, |