In React's terminology, there are five core types that are important to distinguish:
React Elements
In React's terminology, there are five core types that are important to distinguish:
React Elements
/** | |
* @jsx React.DOM | |
*/ | |
var React = require('react'), | |
MyReactComponent = React.createClass({ | |
// The object returned by this method sets the initial value of this.state | |
getInitialState: function(){ | |
return {}; |
Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.
Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.
This is a quick tutorial explaining how to get a static website hosted on Heroku.
Why do this?
Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.
It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.
We used to have a helper function called transferPropsTo
. We no longer support this method. Instead you're expected to use a generic object helper to merge props.
render() {
return Component(Object.assign({}, this.props, { more: 'values' }));
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); |
# config/routes.rb | |
resources :documents do | |
scope module: 'documents' do | |
resources :versions do | |
post :restore, on: :member | |
end | |
resource :lock | |
end | |
end |
require 'active_support/core_ext/time' | |
class BusinessHoursFeature | |
# This feature is only available between the hours of 10am and 4pm | |
def enabled? | |
Time.use_zone('Pacific Time (US & Canada)') do | |
now = Time.zone.now | |
am, pm = Time.zone.parse('10:00'), Time.zone.parse('16:00') | |
weekday = !(now.saturday? || now.sunday?) |
The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
# with their associated values. For example, "{ status: 'delayed' }" would call |