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
def search_list(term, words, deep): | |
result = [] | |
idx = 0 | |
while idx < len(words): | |
try: | |
idx = words.index(term, idx) | |
result.append(idx) | |
idx += 1 # Start from the next element | |
if not deep: | |
break |
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.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
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
"""This is just an example of how to provide permissions on a per-object basis in the admin""" | |
from django.contrib import admin | |
from django.contrib.auth.models import Permission | |
from django.contrib.contenttypes import generic | |
from django.contrib.contenttypes.models import ContentType | |
from account.models import ObjectGroupPermission, ObjectUserPermission | |
from myapp.models import MyModel | |
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 pyactiveresource.activeresource import ActiveResource | |
from biscuit.api import APIHandler | |
ip_translations = {'aaa.bbb.ccc.ddd': 'xxx.yyy.zzz.qqq', | |
'eee.fff.ggg.hhh': 'ppp.qqq.rrr.sss'} | |
slice_api_key = 'xxxxx_YOUR_SLICEHOST_API_KEY_HERE_xxxxx' | |
slice_api_url = 'https://%[email protected]/' % slice_api_key |
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 pyactiveresource.activeresource import ActiveResource | |
from pyactiveresource.connection import UnauthorizedAccess | |
#### CONFIGURATION #### | |
from_ip = 'xxx.xxx.xxx.xxx' | |
to_ip = 'xxx.xxx.xxx.xxx' | |
update_domains = ('domain1.com.','domain2.net.','otherdomain.org.') | |
api_key = 'xxxxx_YOUR_API_KEY_HERE_xxxxx' | |
api_url = 'https://%[email protected]/' % api_key |
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
<html> | |
<head> | |
<script type="text/javascript" src="raphael-1.2.5.js"></script> | |
<script type="text/javascript" src="raphael.path.methods.js"></script> | |
<script type="text/javascript" src="raphael.primitives.js"></script> | |
<script type="text/javascript" src="g.raphael-0.4.js"></script> | |
<script type="text/javascript" src="g.analytics.js"></script> | |
<script type="text/javascript"> | |
$(function () { | |
$("#data").css({ |
NewerOlder