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 cx(classNames, namespace, theme) { | |
var classes; | |
var bemClasses = []; | |
if (typeof classNames == 'object') { | |
classes = Object.keys(classNames).filter(function(className) { | |
return classNames[className]; | |
}); | |
} else { | |
classes = classNames; |
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
var namespace = 'mediacat' | |
function cx(classNames, options) { | |
var classes; | |
var states; | |
var bemClasses = []; | |
var baseClassName; | |
var stateClassName; | |
if (typeof classNames == 'object') { |
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 RichPrimaryKeyRelatedField(serializers.RelatedField): | |
def __init__(self, serializer, *args, **kwargs): | |
self.many = kwargs.get('many', False) | |
self.serializer = serializer | |
super(RichPrimaryKeyRelatedField, self).__init__(*args, **kwargs) | |
def to_internal_value(self, data): | |
try: | |
return self.get_queryset().get(pk=data) |
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
export class Counter extends React.Component { | |
static get propTypes() { | |
return { | |
initialCount: React.PropTypes.number | |
}; | |
} | |
static get defaultProps() { | |
return { | |
initialCount: 1 |
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
import React from 'react'; | |
import shallowEqual from 'react/lib/shallowEqual'; | |
class PureRenderComponent extends React.Component { | |
shouldComponentUpdate(nextProps, nextState) { | |
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState); | |
} | |
} |
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
import React from 'react'; | |
import shallowEqual from 'react/lib/shallowEqual'; | |
class PureRenderComponent extends React.Component { | |
shouldComponentUpdate(nextProps, nextState) { | |
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState); | |
} | |
} |
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
# Instead of this: | |
from django.http import Http404 | |
from django.http.response import ( | |
Http404, HttpResponse, HttpResponseNotAllowed, StreamingHttpResponse, | |
cookie | |
) | |
# Do this: |
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
"use strict" | |
import $ from 'jquery'; // 3rd-party imports | |
import Backbone from 'backbone'; | |
import React from 'react/addons'; | |
import BaseClase from 'ofs/utils/BaseClass'; // 1st-party imports | |
import doStuff from './doStuff'; // Relative imports |
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
import React from 'react'; | |
import DefaultEventPluginOrder from 'react/lib/DefaultEventPluginOrder'; | |
import EventPluginHub from 'react/lib/EventPluginHub'; | |
import EventPluginRegistry from 'react/lib/EventPluginRegistry'; | |
import keyOf from 'react/lib/keyOf'; | |
import ResponderEventPlugin from './ResponderEventPlugin'; | |
import SwipeEventPlugin from './SwipeEventPlugin'; |
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
import React from 'react'; | |
import DefaultEventPluginOrder from 'react/lib/DefaultEventPluginOrder'; | |
import EventPluginHub from 'react/lib/EventPluginHub'; | |
import EventPluginRegistry from 'react/lib/EventPluginRegistry'; | |
import keyOf from 'react/lib/keyOf'; | |
import ResponderEventPlugin from './ResponderEventPlugin'; | |
import SwipeEventPlugin from './SwipeEventPlugin'; |