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://rubygems.org" | |
gem "jammit" | |
gem "closure-compiler" |
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 cStringIO import StringIO | |
@register.simple_tag | |
def thumbnail(image_url, width, height, quality=95): | |
""" | |
Given the URL to an image, resizes the image using the given width and | |
height on the first time it is requested, and returns the URL to the new | |
resized image. if width or height are zero then original ratio is | |
maintained. | |
""" | |
if not image_url: |
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
# Example how to add rich editor capabilities to your models in admin. | |
from django.contrib.admin import site, ModelAdmin | |
import models | |
# we define our resources to add to admin pages | |
class CommonMedia: | |
js = ( | |
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js', |
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
# Enable us to call scrapy from manage.py | |
from __future__ import absolute_import | |
from django.core.management.base import BaseCommand | |
class Command(BaseCommand): | |
def run_from_argv(self, argv): | |
self._argv = argv | |
self.execute() |
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
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> | |
<!-- | |
For other language: Instead of `ace/mode/ruby`, Use | |
Python -> `ace/mode/python` | |
C/C++ -> `ace/mode/c_cpp` | |
Javscript -> `ace/mode/javascript` | |
Java -> `ace/mode/java` |
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 socialregistration.signals import connect as profile_connect | |
PERMISSIONS = { | |
'profile': ('view_profile', 'change_profile'), | |
'user': ('change_user', 'delete_user') | |
} | |
def social_connect_callback(sender, user, profile, client, **kwargs): | |
""" | |
Create a profile for this user after connecting |
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
# What's this? It's a monster list of Google domain names that have been found to refer | |
# users to sites that are monitored with Shaun Inman's "Mint" statistics package. http:/haveamint.com/ | |
# | |
# A huge number of these came from Shawn Blanc's domain list here: | |
# http://shawnblanc.net/2010/08/cleanup-mint-unique-referrers/ | |
# | |
# I merged them in to my existing list for this "MONSTAH LIST". Enjoy! | |
# | |
# To filter many, many of the Google search results from your "Newest Unique Referrers" results in | |
# Mint, copy the list below verbatim (don't include these "comment" lines) and paste them into your |
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
TIME_ZONE = 'Asia/Riyadh' | |
LANGUAGE_CODE = 'ar' | |
ugettext = lambda s: s | |
LANGUAGES = ( | |
('ar', ugettext('Arabic')), | |
('en', ugettext('English')), | |
) |
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 ajax_links_selector = 'a.ajax'; | |
var content_selector = '#content'; | |
var first_call = true; | |
var navilevel_substring = 3; // how many chars from pathname are static (3 for languagecode like /de/) | |
/* needs jquery address loaded: http://www.asual.com/jquery/address/ | |
* | |
* needs feincms to be ajax-enabled: | |
* | |
* feincms/views/base.py: |
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
""" | |
Support for embedding blogs as FeinCMS ApplicationContent | |
""" | |
from django import forms | |
from .models import Blog | |
from .views import blog_detail | |
def get_admin_fields(form, *args, **kwargs): |