Skip to content

Instantly share code, notes, and snippets.

View groovecoder's full-sized avatar
:shipit:

luke crouch groovecoder

:shipit:
View GitHub Profile
mzl.la/devrel-tools-bug
@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);
/*
Togglers within articles (i.e.)
*/
$('.toggleable').mozTogglers();
elasticsearch::plugin{'mobz/elasticsearch-head':
module_dir => 'head',
instances => ['elasticsearch']
}
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)
{% 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 %}
/*
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
};
class Bid(models.Model):
user = models.ForeignKey(User)
url = models.URLField()
ask = models.DecimalField(max_digits=6, decimal_places=2)
offer = models.DecimalField(max_digits=6, decimal_places=2)
class BidViewSet(viewsets.ModelViewSet):
"""
API endpoint for bids. Users can create, update, retrieve, and delete
only their own bids.
url -- url of an OSS bug or issue
"""
model = Bid
serializer_class = BidSerializer
lookup_url_kwarg = 'url'
router = routers.DefaultRouter()
router.register(r'bids', views.BidViewSet)