Skip to content

Instantly share code, notes, and snippets.

View groovecoder's full-sized avatar

luke crouch groovecoder

View GitHub Profile
/*
Track form element events
*/
trackFormEvents: function(target) {
$(target).on('focus click change', 'input, select, button', function(e) {
var data = {
category: 'Form events',
action: e.type,
label: e.target
};
{% autoescape false %}
{# L10n: This is an email. Whitespace matters! #}
{{ _('Hi {username}')|f(username=username) }}
{# L10n: This is an email. Whitespace matters! #}
{% trans %}
Thanks for creating an account on Mozilla Developer Network (MDN) -- a community
making great resources for developers like you.
{% endtrans %}
def form_valid(self, form):
"""
We send our welcome email via celery during complete_signup.
So, we need to manually commit the user to the db for it.
"""
with transaction.commit_on_success():
form.save(self.request)
return helpers.complete_social_signup(self.request,
self.sociallogin)
elasticsearch::plugin{'mobz/elasticsearch-head':
module_dir => 'head',
instances => ['elasticsearch']
}
/*
Togglers within articles (i.e.)
*/
$('.toggleable').mozTogglers();
@groovecoder
groovecoder / gist:11225330
Created April 23, 2014 17:33
Count Hacks Authors
var authors = [], authorElements = document.querySelectorAll('td.column-coauthors a');
for (var i = 0; i < authorElements.length; ++i){
var author = authorElements[i];
if (authors.indexOf ( author.text ) === -1) {
authors.push( author.text );
}
};
alert(authors.length);
mzl.la/devrel-tools-bug
class Meta(object):
unique_together = (('parent', 'locale'), ('slug', 'locale'))
permissions = (
("view_document", "Can view document"),
("add_template_document", "Can add Template:* document"),
("change_template_document", "Can change Template:* document"),
("move_tree", "Can move a tree of documents"),
("purge_document", "Can permanently delete document"),
("restore_document", "Can restore deleted document"),
)
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DocumentDeletionLog'
db.create_table('wiki_documentdeletionlog', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('locale', self.gf('sumo.models.LocaleField')(default='en-US', max_length=7, db_index=True)),
('slug', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
from django.conf.urls import include, patterns, url
from django.views.generic import TemplateView
from sumo.views import redirect_to
from wiki.feeds import (DocumentsRecentFeed, DocumentsReviewFeed, RevisionsFeed,
AttachmentsFeed,
DocumentsUpdatedTranslationParentFeed,)