This file contains 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
class Component extends React.Component { | |
onScroll(event) { | |
this.scrollPosition = getScrollPosition(event); | |
if (this.scrolling) return; | |
this.scrolling = true; | |
const processLongOperation = (beginPosition) => { | |
longOperation(beginPosition, (completionState) => { | |
this.setState(completionState, () => { | |
//rendered |
This file contains 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.conf.urls import url | |
from tastypie.http import HttpGone, HttpMultipleChoices | |
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned | |
from tastypie.resources import ModelResource | |
from recipes.models import Recipe, Ingredient | |
class NestedResourceMixin(object): | |
def prepend_urls(self): | |
resources = super(NestedResourceMixin, self).prepend_urls() |
This file contains 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
(function(){ //don't work in the global scope | |
var double = function(a){ return a * 2; } | |
var process_validation = function(validation_params){ | |
if (validation_params) return function(val){ | |
// do magjiks | |
if (validation_params.filter) val = val.match(validation_params.filter)[0] | |
val = Math.round(val) |