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
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch ''solution\Schema Objects\Programmability\Stored Procedures\dbo.Product_recommendation_insert.proc.sql''' --prune-empty --tag-name-filter cat -- --all |
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
git config url.https://.insteadOf git:// |
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
npm install -g generator-webapp | |
npm install -g generator-chromeapp | |
npm install -g generator-chrome-extension | |
npm install -g generator-angular |
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
#!/bin/sh | |
FILES=$(git diff --cached --name-status | grep -v ^D | awk '$1 $2 { print $2}' | grep -e .py$) | |
if [ -n "$FILES" ]; then | |
pep8 -r $FILES | |
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
model._meta.get_all_field_names() |
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
@render_to('contact.html') | |
def contact(request): | |
form = ContactForm(request.POST or None) | |
if form.is_valid(): | |
# обрабатываем данные. Например, делаем form.save() | |
# ... | |
return redirect('url_name', param1=value) | |
return {'form': form} |
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
:source-file ~/.tmux.conf |
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
s = %some string% | |
size = %chunk size% | |
[s[n:n+size] for n in xrange(0, len(s), size)] |
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
tail -f /var/log/nginx/access.log | ack-grep --flush --passthru --color --color-match=red "^.* 404 .*$" | ack-grep --flush --passthru --color --color-match=green "^.* 200 .*$" |
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
# http://stackoverflow.com/questions/8082670/django-user-passes-test-decorator | |
class SuperuserRequiredMixin(object): | |
@method_decorator(user_passes_test(lambda u: u.is_superuser)) | |
def dispatch(self, *args, **kwargs): | |
return super(SuperuserRequiredMixin, self).dispatch(*args, **kwargs) | |
class MyView(SuperuserRequiredMixin, View): | |
def get(self, request): | |
... |