If you know all the properties that you want to place on a component a head of time, it is easy to use JSX:
var component = <Component foo={x} bar={y} />;
Mutating Props is Bad, mkay
from django.core.exceptions import ValidationError | |
from django.forms.utils import ErrorList | |
from wagtail.wagtailcore import blocks | |
class MyLinkBlock(blocks.StructBlock): | |
""" | |
Example validating StructBlock. | |
""" |
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
#!/bin/bash | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
<div class="panel {{ class_name }}"> | |
<div class="panel-heading"> | |
<h3 class="panel-title">{{ title }}</h3> | |
</div> | |
<div class="panel-body"> | |
{{ content }} | |
</div> | |
</div> |
'use strict'; | |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var del = require('del'); | |
var uglify = require('gulp-uglify'); | |
var gulpif = require('gulp-if'); | |
var exec = require('child_process').exec; | |
var notify = require('gulp-notify'); |
<html> | |
<head> | |
<title>Test</title> | |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
<script src="http://fb.me/react-0.5.1.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
</head> |
alias watchless='watchr -e '\''require "date"; watch("(.*)\.less$") { |f| cmd = "lessc #{f[0]} --source-map #{f[1]}.css"; puts "#{DateTime.now}: #{cmd}"; output = `#{cmd}`; if $? != 0 then puts output end }'\''' |
# custom/processors.py | |
from django.conf import settings | |
from django.core.files.storage import default_storage | |
try: | |
from PIL import Image | |
except ImportError: | |
import Image | |
class Singleton(type): | |
instance = None | |
def __call__(cls, *args, **kwargs): | |
if cls.instance is None: | |
cls.instance = super(Singleton, cls).__call__(*args, **kwargs) | |
return cls.instance | |
if __name__ == '__main__': |