Skip to content

Instantly share code, notes, and snippets.

@crodjer
crodjer / remove_site_context_var.patch
Created March 31, 2011 14:45
Patch to remove `site` context variable
diff --git a/apps/widget/__init__.py b/apps/widget/__init__.py
index 00c4ea7..2aaad03 100644
--- a/apps/widget/__init__.py
+++ b/apps/widget/__init__.py
@@ -51,8 +51,7 @@ def add_config_based_js_files(context, files, compiled_file_name):
in files])
context['js_use_compiled'] = settings.JS_USE_COMPILED
- context['js_dependencies'] = js_files
- context['site'] = Site.objects.get_current()
@crodjer
crodjer / pythonic_list_empty_checks.patch
Created April 5, 2011 06:37
Empty checks for empty list should not be done by comparing lengths and in the teamvideo model a part of code ( a for loop at https://github.com/8planes/mirosubs/blob/master/apps/teams/models.py#L356) seem to be placed at wrong indent.
We couldn’t find that file to show.
@crodjer
crodjer / mirosubs_sitemap.patch
Created April 10, 2011 16:00
Add sitemaps to universal subtitles. To apply do `touch sitemaps.py` in project root directory first
diff --git a/settings.py b/settings.py
index ef8903e..9324082 100644
--- a/settings.py
+++ b/settings.py
@@ -347,6 +347,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
+ 'django.contrib.sitemaps',
'django.contrib.admin',
@crodjer
crodjer / project.md
Created May 5, 2011 18:03
Request Subtitles Project

Functionality providing interface to users for publishing requirements of subtitles.

Google summer of code project of Rohan Jain

#Functionality Required (Discussion: http://piratepad.net/tVDSnTpZ0W)

##User sees (If video does not has at least one subtitle language created)

@crodjer
crodjer / sharing_widget_simplify.patch
Created June 7, 2011 10:16
Show embed code in one line and make the textarea readonly
diff --git a/templates/_sharing_widget.html b/templates/_sharing_widget.html
index eaddcf6..f6ffe94 100644
--- a/templates/_sharing_widget.html
+++ b/templates/_sharing_widget.html
@@ -25,7 +25,7 @@
<h3>{% trans 'Embed this video in your site' %} <a class="embed_options_link" target="embedoptions" href="https://github.com/8planes/mirosubs/wiki/Embed-Code-Usage-Guide">options</a></h3>
<p class="mirosubs-embed">
- <textarea>{{share_panel_embed_code}}</textarea>
+ <textarea readonly="readonly">{{share_panel_embed_code}}</textarea>
@crodjer
crodjer / about-me.mkd
Created March 26, 2012 05:28
django-security-enhancement-proposal

#About Me:

Hi, I am Rohan Jain, a 4th (final) year B.Tech undergraduate Student from Indian Institute of Technology Kharagpur. I have been using django since over a year and generally look into the code base to find about various implementations. I have made attempts to make some minor contributions and if selected this would be my first major one.

More about Me: http://www.rohanjain.in/about/ Github, IRC: crodjer

@crodjer
crodjer / pouch-promises.js
Created March 27, 2013 05:26
Promises in PouchDB
// With the existing Pouch(dbname, callback) api
db = Pouch('adapter://identifier');
data = {
dummy: true
};
promise = db.post(data); // As soon as the db is available, post this data.
// For a callback, it can behave like promises
@crodjer
crodjer / backbone-cache.js
Created April 29, 2013 15:29
Backbone model/collection caching based on the object's url. Uses jStroage for storage.
/*global Backbone:false */
'use strict';
(function() {
var siblingsCache = {}, CacheMixin;
window.siblingsCache = siblingsCache;
// To extend a model/collection do
// _.extend(ModelName, Backbone.CacheMixin);
@crodjer
crodjer / uuids.js
Created May 22, 2013 06:39
Javascript UUIDs
function uuids (count, seed) {
var pattern = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
var _uuids = [];
if (count === undefined) {
count = 1;
}
if (seed === undefined) {
@crodjer
crodjer / string_integer.py
Created May 31, 2013 19:51
An unbounded integer stored in a string.
#!/usr/bin/env python3
import unittest
import random
try:
# Python3, cool!
from itertools import zip_longest
except ImportError:
# I am on python2
from itertools import izip_longest as zip_longest