- Make sure it does something useful.
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 Datepicker = React.createClass({ | |
render: function() { | |
return this.transferPropsTo(<input />); | |
} | |
}); | |
$(document).ready(function() { | |
$('.datepicker').each(function(index, element) { | |
React.renderComponent( | |
<Datepicker />, |
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() { | |
var options = {}; | |
var EntryPoint = require('{{ JS_ENTRY_POINT }}'); | |
var entry = new EntryPoint(options); | |
$(function() { | |
entry.render(document); | |
}); | |
})(); |
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 webpack = require("webpack"); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
entry: { | |
library: './static/js/library' | |
}, | |
output: { | |
path: 'mediacat/static/mediacat/', |
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 Immutable = require('immutable'); | |
var data = Immutable.fromJS({ a: { b: { c: 1 } } }); | |
data.toJS(); | |
// { a: { b: { c: 1 } } } | |
var cursor = data.cursor(['a'], function(newData) { data = newData; }); | |
cursor.set('d', 2); |
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 Mousetrap = require('mousetrap'); | |
var Immutable = require('immutable'); | |
class Keyboard { | |
constructor() { | |
this.keyStack = Immutable.fromJS([[]]); | |
} | |
push() { | |
this.keyStack = this.keyStack.push(Immutable.fromJS([])); |
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 React = require('react'); | |
var KeyboardMixin = { | |
propTypes: { | |
keyboard: React.PropTypes.object | |
}, | |
contextTypes: { | |
keyboard: React.PropTypes.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
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) |
OlderNewer