Ruby > 1.8 : sudo apt-get install ruby
Ruby gems : sudo apt-get install rubygems
Compass : sudo gem install compass
Link compass binary: sudo ln -s /var/lib/gems/1.8/bin/compass/usr/local/bin/compass
or edit COMPASS_BINARY and replace with absolute rute
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 OwnAdmin(admin.ModelAdmin): | |
... | |
def swap_queryset(func): | |
def wrapper(self, request): | |
own_queryset_method = self.queryset | |
self.queryset = super(LeaderAdmin, self).queryset | |
response = func(self, request) | |
self.queryset = own_queryset_method | |
return response | |
return wrapper |
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/ruby | |
if ARGV.length != 1 | |
puts "usage: git2svn <file_name>" | |
puts " file_name - git patch file name" | |
exit | |
end | |
separator = "\n===================================================================\n" | |
new_file = false |
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 | |
# -*- encoding: utf-8 -*- | |
import threading | |
import time | |
from random import random | |
lock = threading.Lock() | |
def thread_safe(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
# Source: http://hints.macworld.com/article.php?story=20020716005123797 | |
if [ ! -f ~/.dirs ]; then # if doesn't exist, create it | |
touch ~/.dirs | |
fi | |
alias show='cat ~/.dirs' | |
save (){ | |
command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ; | |
} | |
source ~/.dirs # Initialization for the above 'save' facility: source the .sdirs file |
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 test | |
test.publish.api() |
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/bash | |
# This hook is run after every virtualenv is activated. | |
export OLD_GEM_HOME=$GEM_HOME | |
export GEM_HOME=$VIRTUAL_ENV/gems/ | |
export GEM_PATH= | |
export PATH=$VIRTUAL_ENV/gems/bin:$PATH |
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
##### Test ... | |
# | |
# DocumentService(name='document1').save() | |
# VideoService(name='video1').save() | |
# DocumentService(name='document2').save() | |
# VideoService(name='video2').save() | |
# | |
# DocumentService.objects.all() | |
#> [<DocumentService: <class 'test_app.models.DocumentService'>: document1>, <DocumentService: <class 'test_app.models.DocumentService'>: document2>] | |
# |
NewerOlder