content_type
stringclasses 8
values | main_lang
stringclasses 7
values | message
stringlengths 1
50
| sha
stringlengths 40
40
| patch
stringlengths 52
962k
| file_count
int64 1
300
|
---|---|---|---|---|---|
Javascript | Javascript | ensure optional chaining in swc matches babel | a65e3612d0a2e16308f3d2a9d962bead435fa587 | <ide><path>packages/next/build/swc/options.js
<ide> export function getJestSWCOptions({
<ide> // Targets the current version of Node.js
<ide> node: process.versions.node,
<ide> },
<add> // we always transpile optional chaining and nullish coalescing
<add> // since it can cause issues with webpack even if the node target
<add> // supports them
<add> include: [
<add> 'proposal-optional-chaining',
<add> 'proposal-nullish-coalescing-operator',
<add> ],
<ide> },
<ide> module: {
<ide> type: esm && !isNextDist ? 'es6' : 'commonjs',
<ide> export function getLoaderSWCOptions({
<ide> // Targets the current version of Node.js
<ide> node: process.versions.node,
<ide> },
<add> // we always transpile optional chaining and nullish coalescing
<add> // since it can cause issues with webpack even if the node target
<add> // supports them
<add> include: [
<add> 'proposal-optional-chaining',
<add> 'proposal-nullish-coalescing-operator',
<add> ],
<ide> },
<ide> }
<ide> } else {
<ide><path>test/integration/production/pages/about.js
<add>import info from '../info.json'
<add>
<add>console.log('info:', info?.something?.nested)
<add>
<ide> export default () => <div className="about-page">About Page</div> | 2 |
PHP | PHP | remove priority. | 8f1798e779da1b2ffd6ed9a57ee0105c34f823d1 | <ide><path>src/Illuminate/Database/Eloquent/Concerns/HasEvents.php
<ide> trait HasEvents
<ide> /**
<ide> * User exposed observable events.
<ide> *
<del> * These are extra user-defind events observers may subscribe to.
<add> * These are extra user-defined events observers may subscribe to.
<ide> *
<ide> * @var array
<ide> */
<ide> trait HasEvents
<ide> * Register an observer with the Model.
<ide> *
<ide> * @param object|string $class
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function observe($class, $priority = 0)
<add> public static function observe($class)
<ide> {
<ide> $instance = new static;
<ide>
<ide> public static function observe($class, $priority = 0)
<ide> // it into the model's event system, making it convenient to watch these.
<ide> foreach ($instance->getObservableEvents() as $event) {
<ide> if (method_exists($class, $event)) {
<del> static::registerModelEvent($event, $className.'@'.$event, $priority);
<add> static::registerModelEvent($event, $className.'@'.$event);
<ide> }
<ide> }
<ide> }
<ide> public function removeObservableEvents($observables)
<ide> *
<ide> * @param string $event
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> protected static function registerModelEvent($event, $callback, $priority = 0)
<add> protected static function registerModelEvent($event, $callback)
<ide> {
<ide> if (isset(static::$dispatcher)) {
<ide> $name = static::class;
<ide>
<del> static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback, $priority);
<add> static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback);
<ide> }
<ide> }
<ide>
<ide> protected function fireCustomModelEvent($event, $method)
<ide> * Register a saving model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function saving($callback, $priority = 0)
<add> public static function saving($callback)
<ide> {
<del> static::registerModelEvent('saving', $callback, $priority);
<add> static::registerModelEvent('saving', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register a saved model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function saved($callback, $priority = 0)
<add> public static function saved($callback)
<ide> {
<del> static::registerModelEvent('saved', $callback, $priority);
<add> static::registerModelEvent('saved', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register an updating model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function updating($callback, $priority = 0)
<add> public static function updating($callback)
<ide> {
<del> static::registerModelEvent('updating', $callback, $priority);
<add> static::registerModelEvent('updating', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register an updated model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function updated($callback, $priority = 0)
<add> public static function updated($callback)
<ide> {
<del> static::registerModelEvent('updated', $callback, $priority);
<add> static::registerModelEvent('updated', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register a creating model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function creating($callback, $priority = 0)
<add> public static function creating($callback)
<ide> {
<del> static::registerModelEvent('creating', $callback, $priority);
<add> static::registerModelEvent('creating', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register a created model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function created($callback, $priority = 0)
<add> public static function created($callback)
<ide> {
<del> static::registerModelEvent('created', $callback, $priority);
<add> static::registerModelEvent('created', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register a deleting model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function deleting($callback, $priority = 0)
<add> public static function deleting($callback)
<ide> {
<del> static::registerModelEvent('deleting', $callback, $priority);
<add> static::registerModelEvent('deleting', $callback);
<ide> }
<ide>
<ide> /**
<ide> * Register a deleted model event with the dispatcher.
<ide> *
<ide> * @param \Closure|string $callback
<del> * @param int $priority
<ide> * @return void
<ide> */
<del> public static function deleted($callback, $priority = 0)
<add> public static function deleted($callback)
<ide> {
<del> static::registerModelEvent('deleted', $callback, $priority);
<add> static::registerModelEvent('deleted', $callback);
<ide> }
<ide>
<ide> /**
<ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testCloneModelMakesAFreshCopyOfTheModel()
<ide> public function testModelObserversCanBeAttachedToModels()
<ide> {
<ide> EloquentModelStub::setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<del> $events->shouldReceive('listen')->once()->with('eloquent.creating: EloquentModelStub', 'EloquentTestObserverStub@creating', 0);
<del> $events->shouldReceive('listen')->once()->with('eloquent.saved: EloquentModelStub', 'EloquentTestObserverStub@saved', 0);
<add> $events->shouldReceive('listen')->once()->with('eloquent.creating: EloquentModelStub', 'EloquentTestObserverStub@creating');
<add> $events->shouldReceive('listen')->once()->with('eloquent.saved: EloquentModelStub', 'EloquentTestObserverStub@saved');
<ide> $events->shouldReceive('forget');
<ide> EloquentModelStub::observe(new EloquentTestObserverStub);
<ide> EloquentModelStub::flushEventListeners();
<ide> public function testModelObserversCanBeAttachedToModels()
<ide> public function testModelObserversCanBeAttachedToModelsWithString()
<ide> {
<ide> EloquentModelStub::setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<del> $events->shouldReceive('listen')->once()->with('eloquent.creating: EloquentModelStub', 'EloquentTestObserverStub@creating', 0);
<del> $events->shouldReceive('listen')->once()->with('eloquent.saved: EloquentModelStub', 'EloquentTestObserverStub@saved', 0);
<add> $events->shouldReceive('listen')->once()->with('eloquent.creating: EloquentModelStub', 'EloquentTestObserverStub@creating');
<add> $events->shouldReceive('listen')->once()->with('eloquent.saved: EloquentModelStub', 'EloquentTestObserverStub@saved');
<ide> $events->shouldReceive('forget');
<ide> EloquentModelStub::observe('EloquentTestObserverStub');
<ide> EloquentModelStub::flushEventListeners(); | 2 |
PHP | PHP | add errorhandling middleware | fbf3de3f44ce5c1b8dd1a194b7ea6aeb841d435c | <ide><path>src/Http/Middleware/ErrorHandlerMiddleware.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.3.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Http\Middleware;
<add>
<add>use Cake\Core\App;
<add>use Cake\Http\ResponseTransformer;
<add>use Exception;
<add>
<add>/**
<add> * Error handling middleware.
<add> *
<add> * Traps exceptions and converts them into HTML or content-type appropriate
<add> * error pages using the CakePHP ExceptionRenderer.
<add> */
<add>class ErrorHandlerMiddleware
<add>{
<add> /**
<add> * Constructor
<add> *
<add> * @param string|callable $renderer The renderer or class name
<add> * to use or a callable factory.
<add> */
<add> public function __construct($renderer = null)
<add> {
<add> $this->renderer = $renderer ?: 'Cake\Error\ExceptionRenderer';
<add> }
<add>
<add> /**
<add> * Wrap the remaining middleware with error handling.
<add> *
<add> * @param \Psr\Http\Message\ServerRequestInterface $request The request.
<add> * @param \Psr\Http\Message\ResponseInterface $response The response.
<add> * @param callable $next Callback to invoke the next middleware.
<add> * @return \Psr\Http\Message\ResponseInterface A response
<add> */
<add> public function __invoke($request, $response, $next)
<add> {
<add> try {
<add> return $next($request, $response);
<add> } catch (\Exception $e) {
<add> return $this->handleException($e, $request, $response);
<add> }
<add> }
<add>
<add> /**
<add> * Handle an exception and generate an error response
<add> *
<add> * @param \Exception $exception The exception to handle.
<add> * @param \Psr\Http\Message\ServerRequestInterface $request The request.
<add> * @param \Psr\Http\Message\ResponseInterface $response The response.
<add> * @return \Psr\Http\Message\ResponseInterface A response
<add> */
<add> public function handleException($exception, $request, $response)
<add> {
<add> $renderer = $this->getRenderer($exception);
<add> try {
<add> $response = $renderer->render();
<add> return ResponseTransformer::toPsr($response);
<add> } catch (Exception $e) {
<add> $message = sprintf(
<add> "[%s] %s\n%s", // Keeping same message format
<add> get_class($e),
<add> $e->getMessage(),
<add> $e->getTraceAsString()
<add> );
<add> trigger_error($message, E_USER_ERROR);
<add> }
<add> return $response;
<add> }
<add>
<add> /**
<add> * Get a renderer instance
<add> *
<add> * @param \Exception $exception The exception being rendered.
<add> * @return \Cake\Error\BaseErrorHandler The exception renderer.
<add> */
<add> protected function getRenderer($exception)
<add> {
<add> if (is_string($this->renderer)) {
<add> $class = App::className($this->renderer, 'Error');
<add> if (!$class) {
<add> throw new \Exception("The '{$this->renderer}' renderer class could not be found.");
<add> }
<add> return new $class($exception);
<add> }
<add> $factory = $this->renderer;
<add> return $factory($exception);
<add> }
<add>}
<ide><path>tests/TestCase/Http/Middleware/ErrorHandlerMiddlewareTest.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.3.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\Http\Middleware;
<add>
<add>use Cake\Core\Configure;
<add>use Cake\Http\Middleware\ErrorHandlerMiddleware;
<add>use Cake\Http\ServerRequestFactory;
<add>use Cake\Network\Response as CakeResponse;
<add>use Cake\TestSuite\TestCase;
<add>use LogicException;
<add>use Zend\Diactoros\Request;
<add>use Zend\Diactoros\Response;
<add>
<add>/**
<add> * Test for ErrorHandlerMiddleware
<add> */
<add>class ErrorHandlerMiddlewareTest extends TestCase
<add>{
<add> /**
<add> * Test returning a response works ok.
<add> *
<add> * @return void
<add> */
<add> public function testNoErrorResponse()
<add> {
<add> $request = ServerRequestFactory::fromGlobals();
<add> $response = new Response();
<add>
<add> $middleware = new ErrorHandlerMiddleware();
<add> $next = function ($req, $res) {
<add> return $res;
<add> };
<add> $result = $middleware($request, $response, $next);
<add> $this->assertSame($result, $response);
<add> }
<add>
<add> /**
<add> * Test an invalid rendering class.
<add> *
<add> * @expectedException Exception
<add> * @expectedExceptionMessage The 'TotallyInvalid' renderer class could not be found
<add> */
<add> public function testInvalidRenderer()
<add> {
<add> $request = ServerRequestFactory::fromGlobals();
<add> $response = new Response();
<add>
<add> $middleware = new ErrorHandlerMiddleware('TotallyInvalid');
<add> $next = function ($req, $res) {
<add> throw new \Exception('Something bad');
<add> };
<add> $middleware($request, $response, $next);
<add> }
<add>
<add> /**
<add> * Test using a factory method to make a renderer.
<add> *
<add> * @return void
<add> */
<add> public function testRendererFactory()
<add> {
<add> $request = ServerRequestFactory::fromGlobals();
<add> $response = new Response();
<add>
<add> $factory = function ($exception) {
<add> $this->assertInstanceOf('LogicException', $exception);
<add> $cakeResponse = new CakeResponse;
<add> $mock = $this->getMock('StdClass', ['render']);
<add> $mock->expects($this->once())
<add> ->method('render')
<add> ->will($this->returnValue($cakeResponse));
<add> return $mock;
<add> };
<add> $middleware = new ErrorHandlerMiddleware($factory);
<add> $next = function ($req, $res) {
<add> throw new LogicException('Something bad');
<add> };
<add> $middleware($request, $response, $next);
<add> }
<add>
<add> /**
<add> * Test rendering an error page
<add> *
<add> * @return void
<add> */
<add> public function testHandleException()
<add> {
<add> Configure::write('App.namespace', 'TestApp');
<add>
<add> $request = ServerRequestFactory::fromGlobals();
<add> $response = new Response();
<add> $middleware = new ErrorHandlerMiddleware();
<add> $next = function ($req, $res) {
<add> throw new \Cake\Network\Exception\NotFoundException('whoops');
<add> };
<add> $result = $middleware($request, $response, $next);
<add> $this->assertNotSame($result, $response);
<add> $this->assertEquals(404, $result->getStatusCode());
<add> $this->assertContains("was not found", '' . $result->getBody());
<add> }
<add>
<add> /**
<add> * Test handling an error and having rendering fail.
<add> *
<add> * @expectedException PHPUnit_Framework_Error
<add> * @return void
<add> */
<add> public function testHandleExceptionRenderingFails()
<add> {
<add> Configure::write('App.namespace', 'TestApp');
<add>
<add> $request = ServerRequestFactory::fromGlobals();
<add> $response = new Response();
<add>
<add> $factory = function ($exception) {
<add> $mock = $this->getMock('StdClass', ['render']);
<add> $mock->expects($this->once())
<add> ->method('render')
<add> ->will($this->throwException(new LogicException('Rendering failed')));
<add> return $mock;
<add> };
<add> $middleware = new ErrorHandlerMiddleware($factory);
<add> $next = function ($req, $res) {
<add> throw new \Cake\Network\Exception\ServiceUnavailableException('whoops');
<add> };
<add> $middleware($request, $response, $next);
<add> }
<add>} | 2 |
Javascript | Javascript | fix spurious eaddrinuse in test-https-strict | 2f417c31930dbe5658a1c5d0356b9071bb5c5ad7 | <ide><path>test/parallel/test-https-strict.js
<ide> var server3 = server(options3);
<ide>
<ide> var listenWait = 0;
<ide>
<del>var port = common.PORT;
<del>var port1 = port++;
<del>var port2 = port++;
<del>var port3 = port++;
<del>server1.listen(port1, listening());
<del>server2.listen(port2, listening());
<del>server3.listen(port3, listening());
<add>server1.listen(0, listening());
<add>server2.listen(0, listening());
<add>server3.listen(0, listening());
<ide>
<ide> var responseErrors = {};
<ide> var expectResponseCount = 0;
<ide> function makeReq(path, port, error, host, ca) {
<ide> }
<ide> var req = https.get(options);
<ide> expectResponseCount++;
<del> var server = port === port1 ? server1
<del> : port === port2 ? server2
<del> : port === port3 ? server3
<add> var server = port === server1.address().port ? server1
<add> : port === server2.address().port ? server2
<add> : port === server3.address().port ? server3
<ide> : null;
<ide>
<ide> if (!server) throw new Error('invalid port: ' + port);
<ide> function makeReq(path, port, error, host, ca) {
<ide> function allListening() {
<ide> // ok, ready to start the tests!
<ide>
<add> const port1 = server1.address().port;
<add> const port2 = server2.address().port;
<add> const port3 = server3.address().port;
<add>
<ide> // server1: host 'agent1', signed by ca1
<ide> makeReq('/inv1', port1, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');
<ide> makeReq('/inv1-ca1', port1, | 1 |
Ruby | Ruby | move cmucl to homebrew-binary | acd2bd07387beb78159c4ff53b1a445253a644fa | <ide><path>Library/Homebrew/tap_migrations.rb
<ide> 'drizzle' => 'homebrew/boneyard',
<ide> 'boost149' => 'homebrew/versions',
<ide> 'aimage' => 'homebrew/boneyard',
<add> 'cmucl' => 'homebrew/binary',
<ide> } | 1 |
Java | Java | add support for custom androidviews | dbe9cc333cfecb49e70f55a82012f8710cc5fad2 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/AndroidView.java
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> */
<add>
<add>package com.facebook.react.flat;
<add>
<add>import com.facebook.csslayout.CSSNode;
<add>import com.facebook.react.uimanager.CatalystStylesDiffMap;
<add>import com.facebook.react.uimanager.ReactShadowNode;
<add>import com.facebook.react.uimanager.ThemedReactContext;
<add>import com.facebook.react.uimanager.ViewGroupManager;
<add>import com.facebook.react.uimanager.ViewManager;
<add>
<add>/* package */ final class AndroidView extends FlatShadowNode {
<add>
<add> final ViewManager mViewManager;
<add> private final ReactShadowNode mReactShadowNode;
<add> private final boolean mNeedsCustomLayoutForChildren;
<add>
<add> /* package */ AndroidView(ViewManager viewManager) {
<add> mViewManager = viewManager;
<add> ReactShadowNode reactShadowNode = viewManager.createShadowNodeInstance();
<add> if (reactShadowNode instanceof CSSNode.MeasureFunction) {
<add> mReactShadowNode = reactShadowNode;
<add> setMeasureFunction((CSSNode.MeasureFunction) reactShadowNode);
<add> } else {
<add> mReactShadowNode = null;
<add> }
<add>
<add> if (viewManager instanceof ViewGroupManager) {
<add> ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
<add> mNeedsCustomLayoutForChildren = viewGroupManager.needsCustomLayoutForChildren();
<add> } else {
<add> mNeedsCustomLayoutForChildren = false;
<add> }
<add>
<add> forceMountToView();
<add> }
<add>
<add> /* package */ boolean needsCustomLayoutForChildren() {
<add> return mNeedsCustomLayoutForChildren;
<add> }
<add>
<add> @Override
<add> public void setBackgroundColor(int backgroundColor) {
<add> // suppress, this is handled by a ViewManager
<add> }
<add>
<add> @Override
<add> public void setThemedContext(ThemedReactContext themedContext) {
<add> super.setThemedContext(themedContext);
<add>
<add> if (mReactShadowNode != null) {
<add> mReactShadowNode.setThemedContext(themedContext);
<add> }
<add> }
<add>
<add> @Override
<add> /* package*/ void handleUpdateProperties(CatalystStylesDiffMap styles) {
<add> if (mReactShadowNode != null) {
<add> mReactShadowNode.updateProperties(styles);
<add> }
<add> }
<add>
<add> @Override
<add> public void addChildAt(CSSNode child, int i) {
<add> super.addChildAt(child, i);
<add> ((FlatShadowNode) child).forceMountToView();
<add> }
<add>}
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatNativeViewHierarchyManager.java
<ide>
<ide> import android.view.View;
<ide> import android.view.View.MeasureSpec;
<add>import android.view.ViewGroup;
<ide>
<ide> import com.facebook.react.uimanager.NativeViewHierarchyManager;
<ide> import com.facebook.react.uimanager.SizeMonitoringFrameLayout;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<add>import com.facebook.react.uimanager.ViewGroupManager;
<ide> import com.facebook.react.uimanager.ViewManagerRegistry;
<ide>
<ide> /**
<ide> public void addRootView(
<ide> }
<ide>
<ide> /* package */ void updateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {
<del> FlatViewGroup view = (FlatViewGroup) resolveView(reactTag);
<del> view.mountViews(this, viewsToAdd, viewsToDetach);
<add> View view = resolveView(reactTag);
<add> if (view instanceof FlatViewGroup) {
<add> ((FlatViewGroup) view).mountViews(this, viewsToAdd, viewsToDetach);
<add> return;
<add> }
<add>
<add> ViewGroup viewGroup = (ViewGroup) view;
<add> ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(reactTag);
<add> for (int i = 0; i < viewsToAdd.length; ++i) {
<add> int tag = Math.abs(viewsToAdd[i]);
<add> viewManager.addView(viewGroup, resolveView(tag), i);
<add> }
<ide> }
<ide>
<ide> /**
<ide> public void addRootView(
<ide>
<ide> /* package */ void detachAllChildrenFromViews(int[] viewsToDetachAllChildrenFrom) {
<ide> for (int viewTag : viewsToDetachAllChildrenFrom) {
<del> FlatViewGroup viewGroup = (FlatViewGroup) resolveView(viewTag);
<del> viewGroup.detachAllViewsFromParent();
<add> View view = resolveView(viewTag);
<add> if (view instanceof FlatViewGroup) {
<add> ((FlatViewGroup) view).detachAllViewsFromParent();
<add> continue;
<add> }
<add>
<add> ViewGroup viewGroup = (ViewGroup) view;
<add> ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(viewTag);
<add> for (int i = viewManager.getChildCount(viewGroup) - 1; i >= 0; --i) {
<add> viewManager.removeViewAt(viewGroup, i);
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java
<ide> protected ReactShadowNode createRootShadowNode() {
<ide> }
<ide>
<ide> @Override
<add> protected ReactShadowNode createShadowNode(String className) {
<add> ReactShadowNode cssNode = super.createShadowNode(className);
<add> if (cssNode instanceof FlatShadowNode) {
<add> return cssNode;
<add> }
<add>
<add> ViewManager viewManager = resolveViewManager(className);
<add> return new AndroidView(viewManager);
<add> }
<add>
<ide> protected void handleCreateView(
<ide> ReactShadowNode cssNode,
<ide> int rootViewTag,
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java
<ide> private void collectStateForMountableNode(
<ide> mNodeRegions.start(node.getNodeRegions());
<ide> mNativeChildren.start(node.getNativeChildren());
<ide>
<del> collectStateRecursively(node, 0, 0, width, height);
<add> boolean isAndroidView = false;
<add> boolean needsCustomLayoutForChildren = false;
<add> if (node instanceof AndroidView) {
<add> isAndroidView = true;
<add> needsCustomLayoutForChildren = ((AndroidView) node).needsCustomLayoutForChildren();
<add> }
<add>
<add> collectStateRecursively(node, 0, 0, width, height, isAndroidView, needsCustomLayoutForChildren);
<ide>
<ide> boolean shouldUpdateMountState = false;
<ide> final DrawCommand[] drawCommands = mDrawCommands.finish();
<ide> private void collectStateRecursively(
<ide> float left,
<ide> float top,
<ide> float right,
<del> float bottom) {
<add> float bottom,
<add> boolean isAndroidView,
<add> boolean needsCustomLayoutForChildren) {
<ide> if (node.hasNewLayout()) {
<ide> node.markLayoutSeen();
<ide> }
<ide> private void collectStateRecursively(
<ide>
<ide> for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) {
<ide> FlatShadowNode child = (FlatShadowNode) node.getChildAt(i);
<del> processNodeAndCollectState(child, left, top);
<add> processNodeAndCollectState(child, left, top, isAndroidView, needsCustomLayoutForChildren);
<ide> }
<ide> }
<ide>
<ide> private void collectStateRecursively(
<ide> private void processNodeAndCollectState(
<ide> FlatShadowNode node,
<ide> float parentLeft,
<del> float parentTop) {
<add> float parentTop,
<add> boolean parentIsAndroidView,
<add> boolean needsCustomLayout) {
<ide> int tag = node.getReactTag();
<ide>
<ide> float width = node.getLayoutWidth();
<ide> private void processNodeAndCollectState(
<ide> ensureBackingViewIsCreated(node, tag, null);
<ide>
<ide> addNativeChild(node);
<del> mDrawCommands.add(DrawView.INSTANCE);
<add> if (!parentIsAndroidView) {
<add> mDrawCommands.add(DrawView.INSTANCE);
<add> }
<ide>
<ide> collectStateForMountableNode(node, tag, width, height);
<del> mViewsToUpdateBounds.add(node);
<add>
<add> if (!needsCustomLayout) {
<add> mViewsToUpdateBounds.add(node);
<add> }
<ide> } else {
<del> collectStateRecursively(node, left, top, right, bottom);
<add> collectStateRecursively(node, left, top, right, bottom, false, false);
<ide> addNodeRegion(node.getNodeRegion());
<ide> }
<ide> } | 4 |
Python | Python | use a with statement instead of try / finally | 8826e0ffc2c5286572dff1d490bcda88a6f7cd64 | <ide><path>numpy/core/code_generators/genapi.py
<ide> def get_versions_hash():
<ide> d = []
<ide>
<ide> file = os.path.join(os.path.dirname(__file__), 'cversions.txt')
<del> fid = open(file, 'r')
<del> try:
<add> with open(file, 'r') as fid:
<ide> for line in fid:
<ide> m = VERRE.match(line)
<ide> if m:
<ide> d.append((int(m.group(1), 16), m.group(2)))
<del> finally:
<del> fid.close()
<ide>
<ide> return dict(d)
<ide>
<ide><path>numpy/core/setup_common.py
<ide> def pyod(filename):
<ide> def _pyod2():
<ide> out = []
<ide>
<del> fid = open(filename, 'rb')
<del> try:
<add> with open(filename, 'rb') as fid:
<ide> yo = [int(oct(int(binascii.b2a_hex(o), 16))) for o in fid.read()]
<del> for i in range(0, len(yo), 16):
<del> line = ['%07d' % int(oct(i))]
<del> line.extend(['%03d' % c for c in yo[i:i+16]])
<del> out.append(" ".join(line))
<del> return out
<del> finally:
<del> fid.close()
<add> for i in range(0, len(yo), 16):
<add> line = ['%07d' % int(oct(i))]
<add> line.extend(['%03d' % c for c in yo[i:i+16]])
<add> out.append(" ".join(line))
<add> return out
<ide>
<ide> def _pyod3():
<ide> out = []
<ide>
<del> fid = open(filename, 'rb')
<del> try:
<add> with open(filename, 'rb') as fid:
<ide> yo2 = [oct(o)[2:] for o in fid.read()]
<del> for i in range(0, len(yo2), 16):
<del> line = ['%07d' % int(oct(i)[2:])]
<del> line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
<del> out.append(" ".join(line))
<del> return out
<del> finally:
<del> fid.close()
<add> for i in range(0, len(yo2), 16):
<add> line = ['%07d' % int(oct(i)[2:])]
<add> line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
<add> out.append(" ".join(line))
<add> return out
<ide>
<ide> if sys.version_info[0] < 3:
<ide> return _pyod2()
<ide><path>numpy/distutils/system_info.py
<ide> def add_system_root(library_root):
<ide> default_x11_include_dirs.extend(['/usr/lib/X11/include',
<ide> '/usr/include/X11'])
<ide>
<del> tmp = None
<del> try:
<del> # Explicitly open/close file to avoid ResourceWarning when
<del> # tests are run in debug mode Python 3.
<del> tmp = open(os.devnull, 'w')
<del> p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE,
<del> stderr=tmp)
<del> except (OSError, DistutilsError):
<del> # OSError if gcc is not installed, or SandboxViolation (DistutilsError
<del> # subclass) if an old setuptools bug is triggered (see gh-3160).
<del> pass
<del> else:
<del> triplet = str(p.communicate()[0].decode().strip())
<del> if p.returncode == 0:
<del> # gcc supports the "-print-multiarch" option
<del> default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
<del> default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
<del> finally:
<del> if tmp is not None:
<del> tmp.close()
<add> with open(os.devnull, 'w') as tmp:
<add> try:
<add> p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE,
<add> stderr=tmp)
<add> except (OSError, DistutilsError):
<add> # OSError if gcc is not installed, or SandboxViolation (DistutilsError
<add> # subclass) if an old setuptools bug is triggered (see gh-3160).
<add> pass
<add> else:
<add> triplet = str(p.communicate()[0].decode().strip())
<add> if p.returncode == 0:
<add> # gcc supports the "-print-multiarch" option
<add> default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
<add> default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
<add>
<ide>
<ide> if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:
<ide> default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib'))
<ide><path>numpy/lib/format.py
<ide> def open_memmap(filename, mode='r+', dtype=None, shape=None,
<ide> shape=shape,
<ide> )
<ide> # If we got here, then it should be safe to create the file.
<del> fp = open(os_fspath(filename), mode+'b')
<del> try:
<add> with open(os_fspath(filename), mode+'b') as fp:
<ide> _write_array_header(fp, d, version)
<ide> offset = fp.tell()
<del> finally:
<del> fp.close()
<ide> else:
<ide> # Read the header of the file first.
<del> fp = open(os_fspath(filename), 'rb')
<del> try:
<add> with open(os_fspath(filename), 'rb') as fp:
<ide> version = read_magic(fp)
<ide> _check_version(version)
<ide>
<ide> def open_memmap(filename, mode='r+', dtype=None, shape=None,
<ide> msg = "Array can't be memory-mapped: Python objects in dtype."
<ide> raise ValueError(msg)
<ide> offset = fp.tell()
<del> finally:
<del> fp.close()
<ide>
<ide> if fortran_order:
<ide> order = 'F' | 4 |
Text | Text | add more info to description list definition | 092cf9b65825e8c036afdd5014b58b5f428bdcc0 | <ide><path>guide/english/html/tutorials/how-to-use-lists/index.md
<ide> title: How to Use Lists
<ide> ---
<ide> ## How to Use Lists
<ide> Lists are used to specify a set of consecutive items or related information in well formed and semantic way, such as a list of ingredients or a list of procedural steps.
<del>HTML markup has three different types of lists - **ordered**, **unordored** and **description** lists.
<add>HTML markup has three different types of lists - **ordered**, **unordered** and **description** lists.
<ide>
<ide> ### Ordered Lists
<ide> An ordered list is used to group a set of related items, in a specific order.
<ide> An unordered list is used to group a set of related items, in no particular orde
<ide>
<ide>
<ide> ### Description Lists
<del>A description list is used to specify a list of terms and their descriptions. This list is created with `<dl>` tag. Each list item is surrounded with `<dd>` tag.
<add>A description list is used to specify a list of terms and their descriptions. This list is created with `<dl>` tag. Each list item made up of a `<dt>` tag surrounding the term and a `<dd>` tag surrounding the description of the term.
<ide>
<ide> ##### Code
<ide> | 1 |
Javascript | Javascript | add $timeout service that supersedes $defer | 4511d39cc748288df70bdc258f98a8f36652e683 | <ide><path>angularFiles.js
<ide> angularFiles = {
<ide> 'src/ng/http.js',
<ide> 'src/ng/httpBackend.js',
<ide> 'src/ng/locale.js',
<add> 'src/ng/timeout.js',
<ide>
<ide> 'src/ng/filter.js',
<ide> 'src/ng/filter/filter.js',
<ide><path>src/AngularPublic.js
<ide> function publishExternalAPI(angular){
<ide> $q: $QProvider,
<ide> $sniffer: $SnifferProvider,
<ide> $templateCache: $TemplateCacheProvider,
<add> $timeout: $TimeoutProvider,
<ide> $window: $WindowProvider
<ide> });
<ide> }
<ide><path>src/ng/defer.js
<ide> /**
<ide> * @ngdoc function
<ide> * @name angular.module.ng.$defer
<add> * @deprecated Made obsolete by $timeout service. Please migrate your code. This service will be
<add> * removed with 1.0 final.
<ide> * @requires $browser
<ide> *
<ide> * @description
<ide> * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled.
<ide> */
<ide> function $DeferProvider(){
<del> this.$get = ['$rootScope', '$browser', function($rootScope, $browser) {
<add> this.$get = ['$rootScope', '$browser', '$log', function($rootScope, $browser, $log) {
<add> $log.warn('$defer service has been deprecated, migrate to $timeout');
<add>
<ide> function defer(fn, delay) {
<ide> return $browser.defer(function() {
<ide> $rootScope.$apply(fn);
<ide><path>src/ng/timeout.js
<add>'use strict';
<add>
<add>
<add>function $TimeoutProvider() {
<add> this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',
<add> function($rootScope, $browser, $q, $exceptionHandler) {
<add> var deferreds = {};
<add>
<add>
<add> /**
<add> * @ngdoc function
<add> * @name angular.module.ng.$timeout
<add> * @requires $browser
<add> *
<add> * @description
<add> * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
<add> * block and delegates any exceptions to
<add> * {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
<add> *
<add> * The return value of registering a timeout function is a promise which will be resolved when
<add> * the timeout is reached and the timeout function is executed.
<add> *
<add> * To cancel a the timeout request, call `$timeout.cancel(promise)`.
<add> *
<add> * In tests you can use {@link angular.module.ngMock.$timeout `$timeout.flush()`} to
<add> * synchronously flush the queue of deferred functions.
<add> *
<add> * @param {function()} fn A function, who's execution should be delayed.
<add> * @param {number=} [delay=0] Delay in milliseconds.
<add> * @param {boolean=} [invokeApply=true] If set to false skips model dirty checking, otherwise
<add> * will invoke `fn` within the {@link angular.module.ng.$rootScope.Scope#$apply $apply} block.
<add> * @returns {*} Promise that will be resolved when the timeout is reached. The value this
<add> * promise will be resolved with is the return value of the `fn` function.
<add> */
<add> function timeout(fn, delay, invokeApply) {
<add> var deferred = $q.defer(),
<add> promise = deferred.promise,
<add> skipApply = (isDefined(invokeApply) && !invokeApply),
<add> timeoutId, cleanup;
<add>
<add> timeoutId = $browser.defer(function() {
<add> try {
<add> deferred.resolve(fn());
<add> } catch(e) {
<add> deferred.reject(e);
<add> $exceptionHandler(e);
<add> }
<add>
<add> if (!skipApply) $rootScope.$apply();
<add> }, delay);
<add>
<add> cleanup = function() {
<add> delete deferreds[promise.$$timeoutId];
<add> };
<add>
<add> promise.$$timeoutId = timeoutId;
<add> deferreds[timeoutId] = deferred;
<add> promise.then(cleanup, cleanup);
<add>
<add> return promise;
<add> }
<add>
<add>
<add> /**
<add> * @ngdoc function
<add> * @name angular.module.ng.$timeout#cancel
<add> * @methodOf angular.module.ng.$timeout
<add> *
<add> * @description
<add> * Cancels a task associated with the `promise`. As a result of this the promise will be
<add> * resolved with a rejection.
<add> *
<add> * @param {Promise} promise Promise returned by the `$timeout` function.
<add> * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
<add> * canceled.
<add> */
<add> timeout.cancel = function(promise) {
<add> if (promise.$$timeoutId in deferreds) {
<add> deferreds[promise.$$timeoutId].reject('canceled');
<add> return $browser.defer.cancel(promise.$$timeoutId);
<add> }
<add> return false;
<add> };
<add>
<add> return timeout;
<add> }];
<add>}
<ide><path>src/ngMock/angular-mocks.js
<ide> function MockXhr() {
<ide> this.abort = angular.noop;
<ide> }
<ide>
<add>
<add>/**
<add> * @ngdoc function
<add> * @name angular.module.ngMock.$timeout
<add> * @description
<add> *
<add> * This service is just a simple decorator for {@link angular.module.ng.$timeout $timeout} service
<add> * that adds a "flush" method.
<add> */
<add>
<add>/**
<add> * @ngdoc method
<add> * @name angular.module.ngMock.$timeout#flush
<add> * @methodOf angular.module.ngMock.$timeout
<add> * @description
<add> *
<add> * Flushes the queue of pending tasks.
<add> */
<add>
<ide> /**
<ide> * @ngdoc overview
<ide> * @name angular.module.ngMock
<ide> angular.module('ngMock', ['ng']).provider({
<ide> $exceptionHandler: angular.mock.$ExceptionHandlerProvider,
<ide> $log: angular.mock.$LogProvider,
<ide> $httpBackend: angular.mock.$HttpBackendProvider
<add>}).config(function($provide) {
<add> $provide.decorator('$timeout', function($delegate, $browser) {
<add> $delegate.flush = function() {
<add> $browser.defer.flush();
<add> };
<add> return $delegate;
<add> });
<ide> });
<ide>
<ide>
<ide><path>test/ng/deferSpec.js
<ide> describe('$defer', function() {
<ide> $provide.factory('$exceptionHandler', function(){
<ide> return jasmine.createSpy('$exceptionHandler');
<ide> });
<add> $provide.value('$log', {warn: noop});
<ide> }));
<ide>
<ide>
<ide><path>test/ng/timeoutSpec.js
<add>'use strict';
<add>
<add>describe('$timeout', function() {
<add>
<add> beforeEach(module(provideLog));
<add>
<add>
<add> it('should delegate functions to $browser.defer', inject(function($timeout, $browser) {
<add> var counter = 0;
<add> $timeout(function() { counter++; });
<add>
<add> expect(counter).toBe(0);
<add>
<add> $browser.defer.flush();
<add> expect(counter).toBe(1);
<add>
<add> expect(function() {$browser.defer.flush();}).toThrow('No deferred tasks to be flushed');
<add> expect(counter).toBe(1);
<add> }));
<add>
<add>
<add> it('should call $apply after each callback is executed', inject(function($timeout, $rootScope) {
<add> var applySpy = spyOn($rootScope, '$apply').andCallThrough();
<add>
<add> $timeout(function() {});
<add> expect(applySpy).not.toHaveBeenCalled();
<add>
<add> $timeout.flush();
<add> expect(applySpy).toHaveBeenCalledOnce();
<add>
<add> applySpy.reset();
<add>
<add> $timeout(function() {});
<add> $timeout(function() {});
<add> $timeout.flush();
<add> expect(applySpy.callCount).toBe(2);
<add> }));
<add>
<add>
<add> it('should NOT call $apply if skipApply is set to true', inject(function($timeout, $rootScope) {
<add> var applySpy = spyOn($rootScope, '$apply').andCallThrough();
<add>
<add> $timeout(function() {}, 12, false);
<add> expect(applySpy).not.toHaveBeenCalled();
<add>
<add> $timeout.flush();
<add> expect(applySpy).not.toHaveBeenCalled();
<add> }));
<add>
<add>
<add> it('should allow you to specify the delay time', inject(function($timeout, $browser) {
<add> var defer = spyOn($browser, 'defer');
<add> $timeout(noop, 123);
<add> expect(defer.callCount).toEqual(1);
<add> expect(defer.mostRecentCall.args[1]).toEqual(123);
<add> }));
<add>
<add>
<add> it('should return a promise which will be resolved with return value of the timeout callback',
<add> inject(function($timeout, log) {
<add> var promise = $timeout(function() { log('timeout'); return 'buba'; });
<add>
<add> promise.then(function(value) { log('promise success: ' + value); }, log.fn('promise error'));
<add> expect(log).toEqual([]);
<add>
<add> $timeout.flush();
<add> expect(log).toEqual(['timeout', 'promise success: buba']);
<add> }));
<add>
<add>
<add> describe('exception handling', function() {
<add>
<add> beforeEach(module(function($exceptionHandlerProvider) {
<add> $exceptionHandlerProvider.mode('log');
<add> }));
<add>
<add>
<add> it('should delegate exception to the $exceptionHandler service', inject(
<add> function($timeout, $exceptionHandler) {
<add> $timeout(function() {throw "Test Error";});
<add> expect($exceptionHandler.errors).toEqual([]);
<add>
<add> $timeout.flush();
<add> expect($exceptionHandler.errors).toEqual(["Test Error"]);
<add> }));
<add>
<add>
<add> it('should call $apply even if an exception is thrown in callback', inject(
<add> function($timeout, $rootScope) {
<add> var applySpy = spyOn($rootScope, '$apply').andCallThrough();
<add>
<add> $timeout(function() {throw "Test Error";});
<add> expect(applySpy).not.toHaveBeenCalled();
<add>
<add> $timeout.flush();
<add> expect(applySpy).toHaveBeenCalled();
<add> }));
<add>
<add>
<add> it('should reject the timeout promise when an exception is thrown in the timeout callback',
<add> inject(function($timeout, log) {
<add> var promise = $timeout(function() { throw "Some Error"; });
<add>
<add> promise.then(log.fn('success'), function(reason) { log('error: ' + reason); });
<add> $timeout.flush();
<add>
<add> expect(log).toEqual('error: Some Error');
<add> }));
<add> });
<add>
<add>
<add> describe('cancel', function() {
<add> it('should cancel tasks', inject(function($timeout) {
<add> var task1 = jasmine.createSpy('task1'),
<add> task2 = jasmine.createSpy('task2'),
<add> task3 = jasmine.createSpy('task3'),
<add> promise1, promise3;
<add>
<add> promise1 = $timeout(task1);
<add> $timeout(task2);
<add> promise3 = $timeout(task3, 333);
<add>
<add> $timeout.cancel(promise3);
<add> $timeout.cancel(promise1);
<add> $timeout.flush();
<add>
<add> expect(task1).not.toHaveBeenCalled();
<add> expect(task2).toHaveBeenCalledOnce();
<add> expect(task3).not.toHaveBeenCalled();
<add> }));
<add>
<add>
<add> it('should return true if a task was successfully canceled', inject(function($timeout) {
<add> var task1 = jasmine.createSpy('task1'),
<add> task2 = jasmine.createSpy('task2'),
<add> promise1, promise2;
<add>
<add> promise1 = $timeout(task1);
<add> $timeout.flush();
<add> promise2 = $timeout(task2);
<add>
<add> expect($timeout.cancel(promise1)).toBe(false);
<add> expect($timeout.cancel(promise2)).toBe(true);
<add> }));
<add> });
<add>});
<ide><path>test/ngMock/angular-mocksSpec.js
<ide> describe('ngMock', function() {
<ide> });
<ide>
<ide>
<add> describe('$timeout', function() {
<add> it('should expose flush method that will flush the pending queue of tasks', inject(
<add> function($timeout) {
<add> var logger = [],
<add> logFn = function(msg) { return function() { logger.push(msg) }};
<add>
<add> $timeout(logFn('t1'));
<add> $timeout(logFn('t2'), 200);
<add> $timeout(logFn('t3'));
<add> expect(logger).toEqual([]);
<add>
<add> $timeout.flush();
<add> expect(logger).toEqual(['t1', 't3', 't2']);
<add> }));
<add> });
<add>
<add>
<ide> describe('angular.mock.dump', function(){
<ide> var d = angular.mock.dump;
<ide> | 8 |
Ruby | Ruby | fix unused argument | ca68085e5977ecd36f566325764b4f86e75447f4 | <ide><path>Library/Homebrew/cask/lib/hbc/dsl.rb
<ide> def sha256(arg = nil)
<ide> @sha256 ||= arg
<ide> end
<ide>
<del> def license(arg = nil)
<add> def license(*)
<ide> odeprecated "Hbc::DSL#license"
<ide> end
<ide> | 1 |
PHP | PHP | apply fixes from styleci | 278c6d7fd04be005c1175a7eaea868976177600c | <ide><path>src/Illuminate/Support/Benchmark.php
<ide> namespace Illuminate\Support;
<ide>
<ide> use Closure;
<del>use Illuminate\Support\Arr;
<ide>
<ide> class Benchmark
<ide> { | 1 |
Mixed | Ruby | fix regression in has_secure_password | 5d93ef8f459254f075616d37763611ad87d86b30 | <ide><path>activemodel/CHANGELOG.md
<add>* Fix regression in has_secure_password. When a password is set, but a
<add> confirmation is an empty string, it would incorrectly save.
<add>
<add> *Steve Klabnik* and *Phillip Calvin*
<add>
<ide> * Deprecate `Validator#setup`. This should be done manually now in the validator's constructor.
<ide>
<ide> *Nick Sutterer*
<ide><path>activemodel/lib/active_model/secure_password.rb
<ide> def has_secure_password(options = {})
<ide> include InstanceMethodsOnActivation
<ide>
<ide> if options.fetch(:validations, true)
<del> validates_confirmation_of :password
<add> validates_confirmation_of :password, if: lambda { |m| m.password.present? }
<ide> validates_presence_of :password, on: :create
<add> validates_presence_of :password_confirmation, if: lambda { |m| m.password.present? }
<ide>
<ide> before_create { raise "Password digest missing on new record" if password_digest.blank? }
<ide> end
<ide> def password=(unencrypted_password)
<ide> end
<ide>
<ide> def password_confirmation=(unencrypted_password)
<del> unless unencrypted_password.blank?
<del> @password_confirmation = unencrypted_password
<del> end
<add> @password_confirmation = unencrypted_password
<ide> end
<ide> end
<ide> end
<ide><path>activemodel/test/cases/secure_password_test.rb
<ide> class SecurePasswordTest < ActiveModel::TestCase
<ide> @user.password_confirmation = ""
<ide> assert @user.valid?(:update), "user should be valid"
<ide> end
<add>
<add> test "will not save if confirmation is blank but password is not" do
<add> @user.password = "password"
<add> @user.password_confirmation = ""
<add> assert_not @user.valid?(:create)
<add>
<add> @user.password_confirmation = "password"
<add> assert @user.valid?(:create)
<add> end
<ide> end | 3 |
PHP | PHP | update definition of an empty model | 940a51b5faa0b88fa5334764c19f93fe8364ef30 | <ide><path>lib/Cake/Model/Datasource/DboSource.php
<ide> protected function _mergeAssociation(&$data, &$merge, $association, $type, $self
<ide> if (isset($merge[$association])) {
<ide> $data[$association] = $merge[$association][0];
<ide> } else {
<del> if (count($merge[0][$association]) > 1) {
<add> if (!empty($merge[0][$association])) {
<ide> foreach ($merge[0] as $assoc => $data2) {
<ide> if ($assoc !== $association) {
<ide> $merge[0][$association][$assoc] = $data2; | 1 |
Python | Python | add cascade to dagrun/taskinstance relationship | 13a558d658c3a1f6df4b2ee5d894fee65dc103db | <ide><path>airflow/models/dagrun.py
<ide> class DagRun(Base, LoggingMixin):
<ide> ),
<ide> )
<ide>
<del> task_instances = relationship(TI, back_populates="dag_run")
<add> task_instances = relationship(
<add> TI, back_populates="dag_run", cascade='save-update, merge, delete, delete-orphan'
<add> )
<ide>
<ide> DEFAULT_DAGRUNS_TO_EXAMINE = airflow_conf.getint(
<ide> 'scheduler', | 1 |
Text | Text | remove extra period | 7e27772625e78090d762f3613957793bfb4cb1ba | <ide><path>README.md
<ide> React is a JavaScript library for building user interfaces.
<ide>
<ide> **NEW**! Check out our newest project [React Native](https://github.com/facebook/react-native), which uses React and JavaScript to create native mobile apps.
<ide>
<del>[Learn how to use React in your own project.](https://facebook.github.io/react/docs/getting-started.html).
<add>[Learn how to use React in your own project](https://facebook.github.io/react/docs/getting-started.html).
<ide>
<ide> ## Examples
<ide> | 1 |
Text | Text | add missing portuguese blocks | e9c8d12703f6e38d1d7b6ff82768a3f1fa34a334 | <ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.md
<add>---
<add>id: 587d781b367417b2b2512abc
<add>title: Adjust the background-color Property of Text
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cEDqwA6'
<add>forumTopicId: 301032
<add>dashedName: adjust-the-background-color-property-of-text
<add>---
<add>
<add># --description--
<add>
<add>Instead of adjusting your overall background or the color of the text to make the foreground easily readable, you can add a `background-color` to the element holding the text you want to emphasize. This challenge uses `rgba()` instead of `hex` codes or normal `rgb()`.
<add>
<add><blockquote>rgba stands for:<br> r = red<br> g = green<br> b = blue<br> a = alpha/level of opacity</blockquote>
<add>
<add>The RGB values can range from 0 to 255. The alpha value can range from 1, which is fully opaque or a solid color, to 0, which is fully transparent or clear. `rgba()` is great to use in this case, as it allows you to adjust the opacity. This means you don't have to completely block out the background.
<add>
<add>You'll use `background-color: rgba(45, 45, 45, 0.1)` for this challenge. It produces a dark gray color that is nearly transparent given the low opacity value of 0.1.
<add>
<add># --instructions--
<add>
<add>To make the text stand out more, adjust the `background-color` of the `h4` element to the given `rgba()` value.
<add>
<add>Also for the `h4`, remove the `height` property and add `padding` of 10px.
<add>
<add># --hints--
<add>
<add>Your code should add a `background-color` property to the `h4` element set to `rgba(45, 45, 45, 0.1)`.
<add>
<add>```js
<add>assert(
<add> /(background-color|background):rgba\(45,45,45,0?\.1\)(;?}|;)/gi.test(
<add> code.replace(/\s/g, '')
<add> )
<add>);
<add>```
<add>
<add>Your code should add a `padding` property to the `h4` element and set it to 10 pixels.
<add>
<add>```js
<add>assert(
<add> $('h4').css('padding-top') == '10px' &&
<add> $('h4').css('padding-right') == '10px' &&
<add> $('h4').css('padding-bottom') == '10px' &&
<add> $('h4').css('padding-left') == '10px'
<add>);
<add>```
<add>
<add>The `height` property on the `h4` element should be removed.
<add>
<add>```js
<add>assert(!($('h4').css('height') == '25px'));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add>
<add>
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> padding: 10px;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.md
<add>---
<add>id: 587d78a4367417b2b2512ad3
<add>title: Adjust the Color of Various Elements to Complementary Colors
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cWmPpud'
<add>forumTopicId: 301033
<add>dashedName: adjust-the-color-of-various-elements-to-complementary-colors
<add>---
<add>
<add># --description--
<add>
<add>The Complementary Colors challenge showed that opposite colors on the color wheel can make each other appear more vibrant when placed side-by-side. However, the strong visual contrast can be jarring if it's overused on a website, and can sometimes make text harder to read if it's placed on a complementary-colored background. In practice, one of the colors is usually dominant and the complement is used to bring visual attention to certain content on the page.
<add>
<add># --instructions--
<add>
<add>This page will use a shade of teal (`#09A7A1`) as the dominant color, and its orange (`#FF790E`) complement to visually highlight the sign-up buttons. Change the `background-color` of both the `header` and `footer` from black to the teal color. Then change the `h2` text `color` to teal as well. Finally, change the `background-color` of the `button` to the orange color.
<add>
<add># --hints--
<add>
<add>The `header` element should have a `background-color` of #09A7A1.
<add>
<add>```js
<add>assert($('header').css('background-color') == 'rgb(9, 167, 161)');
<add>```
<add>
<add>The `footer` element should have a `background-color` of #09A7A1.
<add>
<add>```js
<add>assert($('footer').css('background-color') == 'rgb(9, 167, 161)');
<add>```
<add>
<add>The `h2` element should have a `color` of #09A7A1.
<add>
<add>```js
<add>assert($('h2').css('color') == 'rgb(9, 167, 161)');
<add>```
<add>
<add>The `button` element should have a `background-color` of #FF790E.
<add>
<add>```js
<add>assert($('button').css('background-color') == 'rgb(255, 121, 14)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: white;
<add> }
<add> header {
<add> background-color: black;
<add> color: white;
<add> padding: 0.25em;
<add> }
<add> h2 {
<add> color: black;
<add> }
<add> button {
<add> background-color: white;
<add> }
<add> footer {
<add> background-color: black;
<add> color: white;
<add> padding: 0.5em;
<add> }
<add></style>
<add><header>
<add> <h1>Cooking with FCC!</h1>
<add></header>
<add><main>
<add> <article>
<add> <h2>Machine Learning in the Kitchen</h2>
<add> <p>Join this two day workshop that walks through how to implement cutting-edge snack-getting algorithms with a command line interface. Coding usually involves writing exact instructions, but sometimes you need your computer to execute flexible commands, like <code>fetch Pringles</code>.</p>
<add> <button>Sign Up</button>
<add> </article>
<add> <article>
<add> <h2>Bisection Vegetable Chopping</h2>
<add> <p>This week-long retreat will level-up your coding ninja skills to actual ninja skills. No longer is the humble bisection search limited to sorted arrays or coding interview questions, applying its concepts in the kitchen will have you chopping carrots in O(log n) time before you know it.</p>
<add> <button>Sign Up</button>
<add> </article>
<add></main>
<add><br>
<add><footer>© 2018 FCC Kitchen</footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: white;
<add> }
<add> header {
<add> background-color: #09A7A1;
<add> color: white;
<add> padding: 0.25em;
<add> }
<add> h2 {
<add> color: #09A7A1;
<add> }
<add> button {
<add> background-color: #FF790E;
<add> }
<add> footer {
<add> background-color: #09A7A1;
<add> color: white;
<add> padding: 0.5em;
<add> }
<add></style>
<add><header>
<add> <h1>Cooking with FCC!</h1>
<add></header>
<add><main>
<add> <article>
<add> <h2>Machine Learning in the Kitchen</h2>
<add> <p>Join this two day workshop that walks through how to implement cutting-edge snack-getting algorithms with a command line interface. Coding usually involves writing exact instructions, but sometimes you need your computer to execute flexible commands, like <code>fetch Pringles</code>.</p>
<add> <button>Sign Up</button>
<add> </article>
<add> <article>
<add> <h2>Bisection Vegetable Chopping</h2>
<add> <p>This week-long retreat will level-up your coding ninja skills to actual ninja skills. No longer is the humble bisection search limited to sorted arrays or coding interview questions, applying its concepts in the kitchen will have you chopping carrots in O(log n) time before you know it.</p>
<add> <button>Sign Up</button>
<add> </article>
<add></main>
<add><br>
<add><footer>© 2018 FCC Kitchen</footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.md
<add>---
<add>id: 587d7791367417b2b2512ab5
<add>title: Adjust the Height of an Element Using the height Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cEDaDTN'
<add>forumTopicId: 301034
<add>dashedName: adjust-the-height-of-an-element-using-the-height-property
<add>---
<add>
<add># --description--
<add>
<add>You can specify the height of an element using the `height` property in CSS, similar to the `width` property. Here's an example that changes the height of an image to 20px:
<add>
<add>```css
<add>img {
<add> height: 20px;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Add a `height` property to the `h4` tag and set it to 25px.
<add>
<add>**Note:** You may need to be at 100% zoom to pass the test on this challenge.
<add>
<add># --hints--
<add>
<add>Your code should change the `h4` `height` property to a value of 25 pixels.
<add>
<add>```js
<add>assert(
<add> Math.round(document.querySelector('h4').getBoundingClientRect().height) ===
<add> 25 &&
<add> /h4{\S*height:25px(;\S*}|})/.test($('style').text().replace(/\s/g, ''))
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add>
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> margin-right: 20px;
<add> text-align: left;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> margin-right: 20px;
<add> text-align: left;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.md
<add>---
<add>id: 587d781d367417b2b2512ac8
<add>title: Adjust the Hover State of an Anchor Tag
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cakRGcm'
<add>forumTopicId: 301035
<add>dashedName: adjust-the-hover-state-of-an-anchor-tag
<add>---
<add>
<add># --description--
<add>
<add>This challenge will touch on the usage of pseudo-classes. A pseudo-class is a keyword that can be added to selectors, in order to select a specific state of the element.
<add>
<add>For example, the styling of an anchor tag can be changed for its hover state using the `:hover` pseudo-class selector. Here's the CSS to change the `color` of the anchor tag to red during its hover state:
<add>
<add>```css
<add>a:hover {
<add> color: red;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>The code editor has a CSS rule to style all `a` tags black. Add a rule so that when the user hovers over the `a` tag, the `color` is blue.
<add>
<add># --hints--
<add>
<add>The anchor tag `color` should remain black, only add CSS rules for the `:hover` state.
<add>
<add>```js
<add>assert($('a').css('color') == 'rgb(0, 0, 0)');
<add>```
<add>
<add>The anchor tag should have a `color` of blue on hover.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /a:hover\s*?{\s*?color:\s*?(blue|rgba\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?,\s*?1\s*?\)|#00F|rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\))\s*?;\s*?}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> a {
<add> color: #000;
<add> }
<add>
<add>
<add>
<add></style>
<add><a href="https://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> a {
<add> color: #000;
<add> }
<add> a:hover {
<add> color: rgba(0,0,255,1);
<add> }
<add></style>
<add><a href="https://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md
<add>---
<add>id: 587d78a4367417b2b2512ad4
<add>title: Adjust the Hue of a Color
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cPp38TZ'
<add>forumTopicId: 301036
<add>dashedName: adjust-the-hue-of-a-color
<add>---
<add>
<add># --description--
<add>
<add>Colors have several characteristics including hue, saturation, and lightness. CSS3 introduced the `hsl()` property as an alternative way to pick a color by directly stating these characteristics.
<add>
<add>**Hue** is what people generally think of as 'color'. If you picture a spectrum of colors starting with red on the left, moving through green in the middle, and blue on right, the hue is where a color fits along this line. In `hsl()`, hue uses a color wheel concept instead of the spectrum, where the angle of the color on the circle is given as a value between 0 and 360.
<add>
<add>**Saturation** is the amount of gray in a color. A fully saturated color has no gray in it, and a minimally saturated color is almost completely gray. This is given as a percentage with 100% being fully saturated.
<add>
<add>**Lightness** is the amount of white or black in a color. A percentage is given ranging from 0% (black) to 100% (white), where 50% is the normal color.
<add>
<add>Here are a few examples of using `hsl()` with fully-saturated, normal lightness colors:
<add>
<add><table class='table table-striped'><thead><tr><th>Color</th><th>HSL</th></tr></thead><tbody><tr><td>red</td><td>hsl(0, 100%, 50%)</td></tr><tr><td>yellow</td><td>hsl(60, 100%, 50%)</td></tr><tr><td>green</td><td>hsl(120, 100%, 50%)</td></tr><tr><td>cyan</td><td>hsl(180, 100%, 50%)</td></tr><tr><td>blue</td><td>hsl(240, 100%, 50%)</td></tr><tr><td>magenta</td><td>hsl(300, 100%, 50%)</td></tr></tbody></table>
<add>
<add># --instructions--
<add>
<add>Change the `background-color` of each `div` element based on the class names (`green`, `cyan`, or `blue`) using `hsl()`. All three should have full saturation and normal lightness.
<add>
<add># --hints--
<add>
<add>Your code should use the `hsl()` property to declare the color `green`.
<add>
<add>```js
<add>assert(code.match(/\.green\s*?{\s*?background-color\s*:\s*?hsl/gi));
<add>```
<add>
<add>Your code should use the `hsl()` property to declare the color `cyan`.
<add>
<add>```js
<add>assert(code.match(/\.cyan\s*?{\s*?background-color\s*:\s*?hsl/gi));
<add>```
<add>
<add>Your code should use the `hsl()` property to declare the color `blue`.
<add>
<add>```js
<add>assert(code.match(/\.blue\s*?{\s*?background-color\s*:\s*?hsl/gi));
<add>```
<add>
<add>The `div` element with class `green` should have a `background-color` of green.
<add>
<add>```js
<add>assert($('.green').css('background-color') == 'rgb(0, 255, 0)');
<add>```
<add>
<add>The `div` element with class `cyan` should have a `background-color` of cyan.
<add>
<add>```js
<add>assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
<add>```
<add>
<add>The `div` element with class `blue` should have a `background-color` of blue.
<add>
<add>```js
<add>assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add>
<add> .green {
<add> background-color: #000000;
<add> }
<add>
<add> .cyan {
<add> background-color: #000000;
<add> }
<add>
<add> .blue {
<add> background-color: #000000;
<add> }
<add>
<add> div {
<add> display: inline-block;
<add> height: 100px;
<add> width: 100px;
<add> }
<add></style>
<add>
<add><div class="green"></div>
<add><div class="cyan"></div>
<add><div class="blue"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add>
<add> .green {
<add> background-color: hsl(120, 100%, 50%);
<add> }
<add>
<add> .cyan {
<add> background-color: hsl(180, 100%, 50%);
<add> }
<add>
<add> .blue {
<add> background-color: hsl(240, 100%, 50%);
<add> }
<add>
<add> div {
<add> display: inline-block;
<add> height: 100px;
<add> width: 100px;
<add> }
<add></style>
<add><div class="green"></div>
<add><div class="cyan"></div>
<add><div class="blue"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.md
<add>---
<add>id: 587d781b367417b2b2512abd
<add>title: Adjust the Size of a Header Versus a Paragraph Tag
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c3bRPTz'
<add>forumTopicId: 301037
<add>dashedName: adjust-the-size-of-a-header-versus-a-paragraph-tag
<add>---
<add>
<add># --description--
<add>
<add>The font size of header tags (`h1` through `h6`) should generally be larger than the font size of paragraph tags. This makes it easier for the user to visually understand the layout and level of importance of everything on the page. You use the `font-size` property to adjust the size of the text in an element.
<add>
<add># --instructions--
<add>
<add>To make the heading significantly larger than the paragraph, change the `font-size` of the `h4` tag to 27 pixels.
<add>
<add># --hints--
<add>
<add>Your code should add a `font-size` property to the `h4` element set to 27 pixels.
<add>
<add>```js
<add>assert($('h4').css('font-size') == '27px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add>
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add> font-size: 27px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.md
<add>---
<add>id: 587d78a4367417b2b2512ad5
<add>title: Adjust the Tone of a Color
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cEDJvT7'
<add>forumTopicId: 301038
<add>dashedName: adjust-the-tone-of-a-color
<add>---
<add>
<add># --description--
<add>
<add>The `hsl()` option in CSS also makes it easy to adjust the tone of a color. Mixing white with a pure hue creates a tint of that color, and adding black will make a shade. Alternatively, a tone is produced by adding gray or by both tinting and shading. Recall that the 's' and 'l' of `hsl()` stand for saturation and lightness, respectively. The saturation percent changes the amount of gray and the lightness percent determines how much white or black is in the color. This is useful when you have a base hue you like, but need different variations of it.
<add>
<add># --instructions--
<add>
<add>All elements have a default `background-color` of `transparent`. Our `nav` element currently appears to have a `cyan` background, because the element behind it has a `background-color` set to `cyan`. Add a `background-color` to the `nav` element so it uses the same `cyan` hue, but has `80%` saturation and `25%` lightness values to change its tone and shade.
<add>
<add># --hints--
<add>
<add>The `nav` element should have a `background-color` of the adjusted cyan tone using the `hsl()` property.
<add>
<add>```js
<add>assert(
<add> code.match(/nav\s*?{\s*?background-color:\s*?hsl\(180,\s*?80%,\s*?25%\)/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> header {
<add> background-color: hsl(180, 90%, 35%);
<add> color: #FFFFFF;
<add> }
<add>
<add> nav {
<add>
<add> }
<add>
<add> h1 {
<add> text-indent: 10px;
<add> padding-top: 10px;
<add> }
<add>
<add> nav ul {
<add> margin: 0px;
<add> padding: 5px 0px 5px 30px;
<add> }
<add>
<add> nav li {
<add> display: inline;
<add> margin-right: 20px;
<add> }
<add>
<add> a {
<add> text-decoration: none;
<add> color: inherit;
<add> }
<add></style>
<add>
<add><header>
<add> <h1>Cooking with FCC!</h1>
<add> <nav>
<add> <ul>
<add> <li><a href="#">Home</a></li>
<add> <li><a href="#">Classes</a></li>
<add> <li><a href="#">Contact</a></li>
<add> </ul>
<add> </nav>
<add></header>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> header {
<add> background-color: hsl(180, 90%, 35%);
<add> color: #FFFFFF;
<add> }
<add>
<add> nav {
<add> background-color: hsl(180, 80%, 25%);
<add> }
<add>
<add> h1 {
<add> text-indent: 10px;
<add> padding-top: 10px;
<add> }
<add>
<add> nav ul {
<add> margin: 0px;
<add> padding: 5px 0px 5px 30px;
<add> }
<add>
<add> nav li {
<add> display: inline;
<add> margin-right: 20px;
<add> }
<add>
<add> a {
<add> text-decoration: none;
<add> color: inherit;
<add> }
<add></style>
<add><header>
<add> <h1>Cooking with FCC!</h1>
<add> <nav>
<add> <ul>
<add> <li><a href="#">Home</a></li>
<add> <li><a href="#">Classes</a></li>
<add> <li><a href="#">Contact</a></li>
<add> </ul>
<add> </nav>
<add></header>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.md
<add>---
<add>id: 587d7791367417b2b2512ab4
<add>title: Adjust the Width of an Element Using the width Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cvVLPtN'
<add>forumTopicId: 301039
<add>dashedName: adjust-the-width-of-an-element-using-the-width-property
<add>---
<add>
<add># --description--
<add>
<add>You can specify the width of an element using the `width` property in CSS. Values can be given in relative length units (such as `em`), absolute length units (such as `px`), or as a percentage of its containing parent element. Here's an example that changes the width of an image to 220px:
<add>
<add>```css
<add>img {
<add> width: 220px;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Add a `width` property to the entire card and set it to an absolute value of 245px. Use the `fullCard` class to select the element.
<add>
<add># --hints--
<add>
<add>Your code should change the `width` property of the card to 245 pixels by using the `fullCard` class selector.
<add>
<add>```js
<add>const fullCard = code.match(/\.fullCard\s*{[\s\S]+?[^}]}/g);
<add>assert(
<add> fullCard &&
<add> /width\s*:\s*245px\s*(;|})/gi.test(fullCard[0]) &&
<add> $('.fullCard').css('maxWidth') === 'none'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> margin-right: 20px;
<add> text-align: left;
<add> }
<add> .fullCard {
<add>
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> margin-right: 20px;
<add> text-align: left;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.md
<add>---
<add>id: 587d78a8367417b2b2512ae5
<add>title: Animate Elements at Variable Rates
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cZ89WA4'
<add>forumTopicId: 301040
<add>dashedName: animate-elements-at-variable-rates
<add>---
<add>
<add># --description--
<add>
<add>There are a variety of ways to alter the animation rates of similarly animated elements. So far, this has been achieved by applying an `animation-iteration-count` property and setting `@keyframes` rules.
<add>
<add>To illustrate, the animation on the right consists of two stars that each decrease in size and opacity at the 20% mark in the `@keyframes` rule, which creates the twinkle animation. You can change the `@keyframes` rule for one of the elements so the stars twinkle at different rates.
<add>
<add># --instructions--
<add>
<add>Alter the animation rate for the element with the class name of `star-1` by changing its `@keyframes` rule to 50%.
<add>
<add># --hints--
<add>
<add>The `@keyframes` rule for the `star-1` class should be 50%.
<add>
<add>```js
<add>assert(code.match(/twinkle-1\s*?{\s*?50%/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .stars {
<add> background-color: white;
<add> height: 30px;
<add> width: 30px;
<add> border-radius: 50%;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> .star-1 {
<add> margin-top: 15%;
<add> margin-left: 60%;
<add> animation-name: twinkle-1;
<add> animation-duration: 1s;
<add> }
<add>
<add> .star-2 {
<add> margin-top: 25%;
<add> margin-left: 25%;
<add> animation-name: twinkle-2;
<add> animation-duration: 1s;
<add> }
<add>
<add> @keyframes twinkle-1 {
<add> 20% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> @keyframes twinkle-2 {
<add> 20% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> #back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
<add> }
<add></style>
<add>
<add><div id="back"></div>
<add><div class="star-1 stars"></div>
<add><div class="star-2 stars"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .stars {
<add> background-color: white;
<add> height: 30px;
<add> width: 30px;
<add> border-radius: 50%;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> .star-1 {
<add> margin-top: 15%;
<add> margin-left: 60%;
<add> animation-name: twinkle-1;
<add> animation-duration: 1s;
<add> }
<add>
<add> .star-2 {
<add> margin-top: 25%;
<add> margin-left: 25%;
<add> animation-name: twinkle-2;
<add> animation-duration: 1s;
<add> }
<add>
<add> @keyframes twinkle-1 {
<add> 50% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> @keyframes twinkle-2 {
<add> 20% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> #back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
<add> }
<add></style>
<add><div id="back"></div>
<add><div class="star-1 stars"></div>
<add><div class="star-2 stars"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.md
<add>---
<add>id: 587d78a8367417b2b2512ae3
<add>title: Animate Elements Continually Using an Infinite Animation Count
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cVJDVfq'
<add>forumTopicId: 301041
<add>dashedName: animate-elements-continually-using-an-infinite-animation-count
<add>---
<add>
<add># --description--
<add>
<add>The previous challenges covered how to use some of the animation properties and the `@keyframes` rule. Another animation property is the `animation-iteration-count`, which allows you to control how many times you would like to loop through the animation. Here's an example:
<add>
<add>```css
<add>animation-iteration-count: 3;
<add>```
<add>
<add>In this case the animation will stop after running 3 times, but it's possible to make the animation run continuously by setting that value to `infinite`.
<add>
<add># --instructions--
<add>
<add>To keep the ball bouncing on the right on a continuous loop, change the `animation-iteration-count` property to `infinite`.
<add>
<add># --hints--
<add>
<add>The `animation-iteration-count` property should have a value of `infinite`.
<add>
<add>```js
<add>assert($('#ball').css('animation-iteration-count') == 'infinite');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add> #ball {
<add> width: 100px;
<add> height: 100px;
<add> margin: 50px auto;
<add> position: relative;
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> animation-name: bounce;
<add> animation-duration: 1s;
<add> animation-iteration-count: 3;
<add> }
<add>
<add> @keyframes bounce{
<add> 0% {
<add> top: 0px;
<add> }
<add> 50% {
<add> top: 249px;
<add> width: 130px;
<add> height: 70px;
<add> }
<add> 100% {
<add> top: 0px;
<add> }
<add> }
<add></style>
<add><div id="ball"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #ball {
<add> width: 100px;
<add> height: 100px;
<add> margin: 50px auto;
<add> position: relative;
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> animation-name: bounce;
<add> animation-duration: 1s;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> @keyframes bounce{
<add> 0% {
<add> top: 0px;
<add> }
<add> 50% {
<add> top: 249px;
<add> width: 130px;
<add> height: 70px;
<add> }
<add> 100% {
<add> top: 0px;
<add> }
<add> }
<add></style>
<add><div id="ball"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.md
<add>---
<add>id: 587d78a8367417b2b2512ae6
<add>title: Animate Multiple Elements at Variable Rates
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cnpWZc9'
<add>forumTopicId: 301042
<add>dashedName: animate-multiple-elements-at-variable-rates
<add>---
<add>
<add># --description--
<add>
<add>In the previous challenge, you changed the animation rates for two similarly animated elements by altering their `@keyframes` rules. You can achieve the same goal by manipulating the `animation-duration` of multiple elements.
<add>
<add>In the animation running in the code editor, there are three stars in the sky that twinkle at the same rate on a continuous loop. To make them twinkle at different rates, you can set the `animation-duration` property to different values for each element.
<add>
<add># --instructions--
<add>
<add>Set the `animation-duration` of the elements with the classes `star-1`, `star-2`, and `star-3` to 1s, 0.9s, and 1.1s, respectively.
<add>
<add># --hints--
<add>
<add>The `animation-duration` property for the star with class `star-1` should remain at 1s.
<add>
<add>```js
<add>assert($('.star-1').css('animation-duration') == '1s');
<add>```
<add>
<add>The `animation-duration` property for the star with class `star-2` should be 0.9s.
<add>
<add>```js
<add>assert($('.star-2').css('animation-duration') == '0.9s');
<add>```
<add>
<add>The `animation-duration` property for the star with class `star-3` should be 1.1s.
<add>
<add>```js
<add>assert($('.star-3').css('animation-duration') == '1.1s');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .stars {
<add> background-color: white;
<add> height: 30px;
<add> width: 30px;
<add> border-radius: 50%;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> .star-1 {
<add> margin-top: 15%;
<add> margin-left: 60%;
<add> animation-duration: 1s;
<add> animation-name: twinkle;
<add> }
<add>
<add> .star-2 {
<add> margin-top: 25%;
<add> margin-left: 25%;
<add> animation-duration: 1s;
<add> animation-name: twinkle;
<add> }
<add>
<add> .star-3 {
<add> margin-top: 10%;
<add> margin-left: 50%;
<add> animation-duration: 1s;
<add> animation-name: twinkle;
<add> }
<add>
<add> @keyframes twinkle {
<add> 20% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> #back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
<add> }
<add></style>
<add>
<add><div id="back"></div>
<add><div class="star-1 stars"></div>
<add><div class="star-2 stars"></div>
<add><div class="star-3 stars"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .stars {
<add> background-color: white;
<add> height: 30px;
<add> width: 30px;
<add> border-radius: 50%;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> .star-1 {
<add> margin-top: 15%;
<add> margin-left: 60%;
<add> animation-duration: 1s;
<add> animation-name: twinkle;
<add> }
<add>
<add> .star-2 {
<add> margin-top: 25%;
<add> margin-left: 25%;
<add> animation-duration: 0.9s;
<add> animation-name: twinkle;
<add> }
<add>
<add> .star-3 {
<add> margin-top: 10%;
<add> margin-left: 50%;
<add> animation-duration: 1.1s;
<add> animation-name: twinkle;
<add> }
<add>
<add> @keyframes twinkle {
<add> 20% {
<add> transform: scale(0.5);
<add> opacity: 0.5;
<add> }
<add> }
<add>
<add> #back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
<add> }
<add></style>
<add><div id="back"></div>
<add><div class="star-1 stars"></div>
<add><div class="star-2 stars"></div>
<add><div class="star-3 stars"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.md
<add>---
<add>id: 587d78a3367417b2b2512ad0
<add>title: Center an Element Horizontally Using the margin Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cyLJqU4'
<add>forumTopicId: 301043
<add>dashedName: center-an-element-horizontally-using-the-margin-property
<add>---
<add>
<add># --description--
<add>
<add>Another positioning technique is to center a block element horizontally. One way to do this is to set its `margin` to a value of auto.
<add>
<add>This method works for images, too. Images are inline elements by default, but can be changed to block elements when you set the `display` property to `block`.
<add>
<add># --instructions--
<add>
<add>Center the `div` on the page by adding a `margin` property with a value of `auto`.
<add>
<add># --hints--
<add>
<add>The `div` should have a `margin` set to `auto`.
<add>
<add>```js
<add>assert(code.match(/margin:\s*?auto;/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> background-color: blue;
<add> height: 100px;
<add> width: 100px;
<add>
<add> }
<add></style>
<add><div></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> background-color: blue;
<add> height: 100px;
<add> width: 100px;
<add> margin: auto;
<add> }
<add></style>
<add><div></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.md
<add>---
<add>id: 587d781e367417b2b2512ac9
<add>title: Change an Element's Relative Position
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/czVmMtZ'
<add>forumTopicId: 301044
<add>dashedName: change-an-elements-relative-position
<add>---
<add>
<add># --description--
<add>
<add>CSS treats each HTML element as its own box, which is usually referred to as the <dfn>CSS Box Model</dfn>. Block-level items automatically start on a new line (think headings, paragraphs, and divs) while inline items sit within surrounding content (like images or spans). The default layout of elements in this way is called the <dfn>normal flow</dfn> of a document, but CSS offers the position property to override it.
<add>
<add>When the position of an element is set to `relative`, it allows you to specify how CSS should move it *relative* to its current position in the normal flow of the page. It pairs with the CSS offset properties of `left` or `right`, and `top` or `bottom`. These say how many pixels, percentages, or ems to move the item *away* from where it is normally positioned. The following example moves the paragraph 10 pixels away from the bottom:
<add>
<add>```css
<add>p {
<add> position: relative;
<add> bottom: 10px;
<add>}
<add>```
<add>
<add>Changing an element's position to relative does not remove it from the normal flow - other elements around it still behave as if that item were in its default position.
<add>
<add>**Note:** Positioning gives you a lot of flexibility and power over the visual layout of a page. It's good to remember that no matter the position of elements, the underlying HTML markup should be organized and make sense when read from top to bottom. This is how users with visual impairments (who rely on assistive devices like screen readers) access your content.
<add>
<add># --instructions--
<add>
<add>Change the `position` of the `h2` to `relative`, and use a CSS offset to move it 15 pixels away from the `top` of where it sits in the normal flow. Notice there is no impact on the positions of the surrounding h1 and p elements.
<add>
<add># --hints--
<add>
<add>The `h2` element should have a `position` property set to `relative`.
<add>
<add>```js
<add>assert($('h2').css('position') == 'relative');
<add>```
<add>
<add>Your code should use a CSS offset to relatively position the `h2` 15px away from the `top` of where it normally sits.
<add>
<add>```js
<add>assert($('h2').css('top') == '15px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h2 {
<add>
<add>
<add> }
<add></style>
<add><body>
<add> <h1>On Being Well-Positioned</h1>
<add> <h2>Move me!</h2>
<add> <p>I still think the h2 is where it normally sits.</p>
<add></body>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h2 {
<add> position: relative;
<add> top: 15px;
<add> }
<add></style>
<add><body>
<add> <h1>On Being Well-Positioned</h1>
<add> <h2>Move me!</h2>
<add> <p>I still think the h2 is where it normally sits.</p>
<add></body>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.md
<add>---
<add>id: 587d78a8367417b2b2512ae7
<add>title: Change Animation Timing with Keywords
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cJKvwCM'
<add>forumTopicId: 301045
<add>dashedName: change-animation-timing-with-keywords
<add>---
<add>
<add># --description--
<add>
<add>In CSS animations, the `animation-timing-function` property controls how quickly an animated element changes over the duration of the animation. If the animation is a car moving from point A to point B in a given time (your `animation-duration`), the `animation-timing-function` says how the car accelerates and decelerates over the course of the drive.
<add>
<add>There are a number of predefined keywords available for popular options. For example, the default value is `ease`, which starts slow, speeds up in the middle, and then slows down again in the end. Other options include `ease-out`, which is quick in the beginning then slows down, `ease-in`, which is slow in the beginning, then speeds up at the end, or `linear`, which applies a constant animation speed throughout.
<add>
<add># --instructions--
<add>
<add>For the elements with id of `ball1` and `ball2`, add an `animation-timing-function` property to each, and set `#ball1` to `linear`, and `#ball2` to `ease-out`. Notice the difference between how the elements move during the animation but end together, since they share the same `animation-duration` of 2 seconds.
<add>
<add># --hints--
<add>
<add>The value of the `animation-timing-function` property for the element with the id `ball1` should be `linear`.
<add>
<add>```js
<add>const ball1Animation = __helpers.removeWhiteSpace(
<add> $('#ball1').css('animation-timing-function')
<add>);
<add>assert(ball1Animation == 'linear' || ball1Animation == 'cubic-bezier(0,0,1,1)');
<add>```
<add>
<add>The value of the `animation-timing-function` property for the element with the id `ball2` should be `ease-out`.
<add>
<add>```js
<add>const ball2Animation = __helpers.removeWhiteSpace(
<add> $('#ball2').css('animation-timing-function')
<add>);
<add>assert(
<add> ball2Animation == 'ease-out' || ball2Animation == 'cubic-bezier(0,0,0.58,1)'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add> .balls {
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #ball1 {
<add> left:27%;
<add>
<add> }
<add> #ball2 {
<add> left:56%;
<add>
<add> }
<add>
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add>
<add></style>
<add>
<add><div class="balls" id="ball1"></div>
<add><div class="balls" id="ball2"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .balls {
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #ball1 {
<add> left:27%;
<add> animation-timing-function: linear;
<add> }
<add> #ball2 {
<add> left:56%;
<add> animation-timing-function: ease-out;
<add> }
<add>
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add></style>
<add><div class="balls" id="ball1"></div>
<add><div class="balls" id="ball2"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.md
<add>---
<add>id: 587d78a3367417b2b2512acf
<add>title: Change the Position of Overlapping Elements with the z-index Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cM94aHk'
<add>forumTopicId: 301046
<add>dashedName: change-the-position-of-overlapping-elements-with-the-z-index-property
<add>---
<add>
<add># --description--
<add>
<add>When elements are positioned to overlap (i.e. using `position: absolute | relative | fixed | sticky`), the element coming later in the HTML markup will, by default, appear on the top of the other elements. However, the `z-index` property can specify the order of how elements are stacked on top of one another. It must be an integer (i.e. a whole number and not a decimal), and higher values for the `z-index` property of an element move it higher in the stack than those with lower values.
<add>
<add># --instructions--
<add>
<add>Add a `z-index` property to the element with the class name of `first` (the red rectangle) and set it to a value of 2 so it covers the other element (blue rectangle).
<add>
<add># --hints--
<add>
<add>The element with class `first` should have a `z-index` value of 2.
<add>
<add>```js
<add>assert($('.first').css('z-index') == '2');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 60%;
<add> height: 200px;
<add> margin-top: 20px;
<add> }
<add>
<add> .first {
<add> background-color: red;
<add> position: absolute;
<add>
<add> }
<add> .second {
<add> background-color: blue;
<add> position: absolute;
<add> left: 40px;
<add> top: 50px;
<add> z-index: 1;
<add> }
<add></style>
<add>
<add><div class="first"></div>
<add><div class="second"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 60%;
<add> height: 200px;
<add> margin-top: 20px;
<add> }
<add>
<add> .first {
<add> background-color: red;
<add> position: absolute;
<add> z-index: 2;
<add> }
<add> .second {
<add> background-color: blue;
<add> position: absolute;
<add> left: 40px;
<add> top: 50px;
<add> z-index: 1;
<add> }
<add></style>
<add><div class="first"></div>
<add><div class="second"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.md
<add>---
<add>id: 587d78a5367417b2b2512ad6
<add>title: Create a Gradual CSS Linear Gradient
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cg4dpt9'
<add>forumTopicId: 301047
<add>dashedName: create-a-gradual-css-linear-gradient
<add>---
<add>
<add># --description--
<add>
<add>Applying a color on HTML elements is not limited to one flat hue. CSS provides the ability to use color transitions, otherwise known as gradients, on elements. This is accessed through the `background` property's `linear-gradient()` function. Here is the general syntax:
<add>
<add>```css
<add>background: linear-gradient(gradient_direction, color 1, color 2, color 3, ...);
<add>```
<add>
<add>The first argument specifies the direction from which color transition starts - it can be stated as a degree, where `90deg` makes a horizontal gradient (from left to right) and `45deg` makes a diagonal gradient (from bottom left to top right). The following arguments specify the order of colors used in the gradient.
<add>
<add>Example:
<add>
<add>```css
<add>background: linear-gradient(90deg, red, yellow, rgb(204, 204, 255));
<add>```
<add>
<add># --instructions--
<add>
<add>Use a `linear-gradient()` for the `div` element's `background`, and set it from a direction of 35 degrees to change the color from `#CCFFFF` to `#FFCCCC`.
<add>
<add># --hints--
<add>
<add>The `div` element should have a `linear-gradient` `background` with the specified direction and colors.
<add>
<add>```js
<add>assert(
<add> $('div')
<add> .css('background-image')
<add> .match(
<add> /linear-gradient\(35deg, rgb\(204, 255, 255\), rgb\(255, 204, 204\)\)/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> border-radius: 20px;
<add> width: 70%;
<add> height: 400px;
<add> margin: 50px auto;
<add>
<add> }
<add>
<add></style>
<add>
<add><div></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> border-radius: 20px;
<add> width: 70%;
<add> height: 400px;
<add> margin: 50px auto;
<add> background: linear-gradient(35deg, #CCFFFF, #FFCCCC);
<add> }
<add></style>
<add><div></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.md
<add>---
<add>id: 587d78a6367417b2b2512add
<add>title: Create a Graphic Using CSS
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cEDWPs6'
<add>forumTopicId: 301048
<add>dashedName: create-a-graphic-using-css
<add>---
<add>
<add># --description--
<add>
<add>By manipulating different selectors and properties, you can make interesting shapes. One of the easier ones to try is a crescent moon shape. For this challenge you need to work with the `box-shadow` property that sets the shadow of an element, along with the `border-radius` property that controls the roundness of the element's corners.
<add>
<add>You will create a round, transparent object with a crisp shadow that is slightly offset to the side - the shadow is actually going to be the moon shape you see.
<add>
<add>In order to create a round object, the `border-radius` property should be set to a value of 50%.
<add>
<add>You may recall from an earlier challenge that the `box-shadow` property takes values for `offset-x`, `offset-y`, `blur-radius`, `spread-radius` and a color value in that order. The `blur-radius` and `spread-radius` values are optional.
<add>
<add># --instructions--
<add>
<add>Manipulate the square element in the editor to create the moon shape. First, change the `background-color` to `transparent`, then set the `border-radius` property to 50% to make the circular shape. Finally, change the `box-shadow` property to set the `offset-x` to 25px, the `offset-y` to 10px, `blur-radius` to 0, `spread-radius` to 0, and color to `blue`.
<add>
<add># --hints--
<add>
<add>The value of the `background-color` property should be set to `transparent`.
<add>
<add>```js
<add>assert(code.match(/background-color:\s*?transparent;/gi));
<add>```
<add>
<add>The value of the `border-radius` property should be set to `50%`.
<add>
<add>```js
<add>assert(code.match(/border-radius:\s*?50%;/gi));
<add>```
<add>
<add>The value of the `box-shadow` property should be set to 25px for `offset-x`, 10px for `offset-y`, 0 for `blur-radius`, 0 for `spread-radius`, and finally `blue` for the color.
<add>
<add>```js
<add>assert(
<add> code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .center {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> width: 100px;
<add> height: 100px;
<add> background-color: blue;
<add> border-radius: 0px;
<add> box-shadow: 25px 10px 10px 10px green;
<add> }
<add>
<add></style>
<add><div class="center"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .center {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> width: 100px;
<add> height: 100px;
<add> background-color: transparent;
<add> border-radius: 50%;
<add> box-shadow: 25px 10px 0 0 blue;
<add> }
<add></style>
<add><div class="center"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.md
<add>---
<add>id: 587d781b367417b2b2512abb
<add>title: Create a Horizontal Line Using the hr Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c3bR8t7'
<add>forumTopicId: 301049
<add>dashedName: create-a-horizontal-line-using-the-hr-element
<add>---
<add>
<add># --description--
<add>
<add>You can use the `hr` tag to add a horizontal line across the width of its containing element. This can be used to define a change in topic or to visually separate groups of content.
<add>
<add># --instructions--
<add>
<add>Add an `hr` tag underneath the `h4` which contains the card title.
<add>
<add>**Note:** In HTML, `hr` is a self-closing tag, and therefore doesn't need a separate closing tag.
<add>
<add># --hints--
<add>
<add>Your code should add an `hr` tag to the markup.
<add>
<add>```js
<add>assert($('hr').length == 1);
<add>```
<add>
<add>The `hr` tag should come between the title and the paragraph.
<add>
<add>```js
<add>assert(code.match(/<\/h4>\s*?<hr(>|\s*?\/>)\s*?<p>/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4><s>Google</s>Alphabet</h4>
<add>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4><s>Google</s>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.md
<add>---
<add>id: 587d78a6367417b2b2512ade
<add>title: Create a More Complex Shape Using CSS and HTML
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cPpz4fr'
<add>forumTopicId: 301050
<add>dashedName: create-a-more-complex-shape-using-css-and-html
<add>---
<add>
<add># --description--
<add>
<add>One of the most popular shapes in the world is the heart shape, and in this challenge you'll create one using pure CSS. But first, you need to understand the `::before` and `::after` pseudo-elements. These pseudo-elements are used to add something before or after a selected element. In the following example, a `::before` pseudo-element is used to add a rectangle to an element with the class `heart`:
<add>
<add>```css
<add>.heart::before {
<add> content: "";
<add> background-color: yellow;
<add> border-radius: 25%;
<add> position: absolute;
<add> height: 50px;
<add> width: 70px;
<add> top: -50px;
<add> left: 5px;
<add>}
<add>```
<add>
<add>For the `::before` and `::after` pseudo-elements to function properly, they must have a defined `content` property. This property is usually used to add things like a photo or text to the selected element. When the `::before` and `::after` pseudo-elements are used to make shapes, the `content` property is still required, but it's set to an empty string. In the above example, the element with the class of `heart` has a `::before` pseudo-element that produces a yellow rectangle with height and width of `50px` and `70px`, respectively. This rectangle has round corners due to its 25% `border-radius` and is positioned absolutely at `5px` from the left and `50px` above the top of the element.
<add>
<add># --instructions--
<add>
<add>Transform the element on the screen to a heart. In the `heart::after` selector, change the `background-color` to `pink` and the `border-radius` to 50%.
<add>
<add>Next, target the element with the class `heart` (just `heart`) and fill in the `transform` property. Use the `rotate()` function with -45 degrees.
<add>
<add>Finally, in the `heart::before` selector, set its `content` property to an empty string.
<add>
<add># --hints--
<add>
<add>The `background-color` property of the `heart::after` selector should be `pink`.
<add>
<add>```js
<add>const heartAfter = code.match(/\.heart::after\s*{[\s\S]+?[^\}]}/g)[0];
<add>assert(
<add> /({|;)\s*background-color\s*:\s*pink\s*(;|})/g.test(heartAfter)
<add>);
<add>```
<add>
<add>The `border-radius` of the `heart::after` selector should be 50%.
<add>
<add>```js
<add>assert(code.match(/border-radius\s*?:\s*?50%/gi).length == 2);
<add>```
<add>
<add>The `transform` property for the `heart` class should use a `rotate()` function set to -45 degrees.
<add>
<add>```js
<add>assert(code.match(/transform\s*?:\s*?rotate\(\s*?-45deg\s*?\)/gi));
<add>```
<add>
<add>The `content` of the `heart::before` selector should be an empty string.
<add>
<add>```js
<add>assert(code.match(/\.heart::before\s*?{\s*?content\s*?:\s*?("|')\1\s*?;/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .heart {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> background-color: pink;
<add> height: 50px;
<add> width: 50px;
<add> transform: ;
<add> }
<add> .heart::after {
<add> background-color: blue;
<add> content: "";
<add> border-radius: 25%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: 0px;
<add> left: 25px;
<add> }
<add> .heart::before {
<add> content: ;
<add> background-color: pink;
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: -25px;
<add> left: 0px;
<add> }
<add></style>
<add><div class="heart"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .heart {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> background-color: pink;
<add> height: 50px;
<add> width: 50px;
<add> transform: rotate(-45deg);
<add> }
<add> .heart::after {
<add> background-color: pink;
<add> content: "";
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: 0px;
<add> left: 25px;
<add> }
<add> .heart::before {
<add> content: "";
<add> background-color: pink;
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: -25px;
<add> left: 0px;
<add> }
<add></style>
<add><div class="heart"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.md
<add>---
<add>id: 587d78a7367417b2b2512ae1
<add>title: Create Movement Using CSS Animation
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c7amZfW'
<add>forumTopicId: 301051
<add>dashedName: create-movement-using-css-animation
<add>---
<add>
<add># --description--
<add>
<add>When elements have a specified `position`, such as `fixed` or `relative`, the CSS offset properties `right`, `left`, `top`, and `bottom` can be used in animation rules to create movement.
<add>
<add>As shown in the example below, you can push the item downwards then upwards by setting the `top` property of the `50%` keyframe to 50px, but having it set to 0px for the first (`0%`) and the last (`100%`) keyframe.
<add>
<add>```css
<add>@keyframes rainbow {
<add> 0% {
<add> background-color: blue;
<add> top: 0px;
<add> }
<add> 50% {
<add> background-color: green;
<add> top: 50px;
<add> }
<add> 100% {
<add> background-color: yellow;
<add> top: 0px;
<add> }
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Add a horizontal motion to the `div` animation. Using the `left` offset property, add to the `@keyframes` rule so rainbow starts at 0 pixels at `0%`, moves to 25 pixels at `50%`, and ends at -25 pixels at `100%`. Don't replace the `top` property in the editor - the animation should have both vertical and horizontal motion.
<add>
<add># --hints--
<add>
<add>The `@keyframes` rule for `0%` should use the `left` offset of 0px.
<add>
<add>```js
<add>assert(code.match(/[^50]0%\s*?{[\s\S]*?left:\s*?0px(;[\s\S]*?|\s*?)}/gi));
<add>```
<add>
<add>The `@keyframes` rule for `50%` should use the `left` offset of 25px.
<add>
<add>```js
<add>assert(code.match(/50%\s*?{[\s\S]*?left:\s*?25px(;[\s\S]*?|\s*?)}/gi));
<add>```
<add>
<add>The `@keyframes` rule for `100%` should use the `left` offset of -25px.
<add>
<add>```js
<add>assert(code.match(/100%\s*?{[\s\S]*?left:\s*?-25px(;[\s\S]*?|\s*?)}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> height: 40px;
<add> width: 70%;
<add> background: black;
<add> margin: 50px auto;
<add> border-radius: 5px;
<add> position: relative;
<add> }
<add>
<add> #rect {
<add> animation-name: rainbow;
<add> animation-duration: 4s;
<add> }
<add>
<add> @keyframes rainbow {
<add> 0% {
<add> background-color: blue;
<add> top: 0px;
<add>
<add> }
<add> 50% {
<add> background-color: green;
<add> top: 50px;
<add>
<add> }
<add> 100% {
<add> background-color: yellow;
<add> top: 0px;
<add>
<add> }
<add> }
<add></style>
<add>
<add><div id="rect"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> height: 40px;
<add> width: 70%;
<add> background: black;
<add> margin: 50px auto;
<add> border-radius: 5px;
<add> position: relative;
<add> }
<add>
<add> #rect {
<add> animation-name: rainbow;
<add> animation-duration: 4s;
<add> }
<add>
<add> @keyframes rainbow {
<add> 0% {
<add> background-color: blue;
<add> top: 0px;
<add> left: 0px;
<add> }
<add> 50% {
<add> background-color: green;
<add> top: 50px;
<add> left: 25px;
<add> }
<add> 100% {
<add> background-color: yellow;
<add> top: 0px;
<add> left: -25px;
<add> }
<add> }
<add></style>
<add><div id="rect"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.md
<add>---
<add>id: 587d78a5367417b2b2512ad8
<add>title: Create Texture by Adding a Subtle Pattern as a Background Image
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cQdwJC8'
<add>forumTopicId: 301052
<add>dashedName: create-texture-by-adding-a-subtle-pattern-as-a-background-image
<add>---
<add>
<add># --description--
<add>
<add>One way to add texture and interest to a background and have it stand out more is to add a subtle pattern. The key is balance, as you don't want the background to stand out too much, and take away from the foreground. The `background` property supports the `url()` function in order to link to an image of the chosen texture or pattern. The link address is wrapped in quotes inside the parentheses.
<add>
<add># --instructions--
<add>
<add>Using the url of `https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png`, set the `background` of the whole page with the `body` selector.
<add>
<add># --hints--
<add>
<add>Your `body` element should have a `background` property set to a `url()` with the given link.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /background:\s*?url\(\s*("|'|)https:\/\/cdn-media-1\.freecodecamp\.org\/imgr\/MJAkxbh\.png\1\s*\)/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add>
<add> }
<add></style>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background: url("https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png");
<add> }
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
<add>---
<add>id: 587d7791367417b2b2512ab3
<add>title: Create Visual Balance Using the text-align Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c3b4EAp'
<add>forumTopicId: 301053
<add>dashedName: create-visual-balance-using-the-text-align-property
<add>---
<add>
<add># --description--
<add>
<add>This section of the curriculum focuses on Applied Visual Design. The first group of challenges build on the given card layout to show a number of core principles.
<add>
<add>Text is often a large part of web content. CSS has several options for how to align it with the `text-align` property.
<add>
<add>`text-align: justify;` causes all lines of text except the last line to meet the left and right edges of the line box.
<add>
<add>`text-align: center;` centers the text
<add>
<add>`text-align: right;` right-aligns the text
<add>
<add>And `text-align: left;` (the default) left-aligns the text.
<add>
<add># --instructions--
<add>
<add>Align the `h4` tag's text, which says "Google", to the center. Then justify the paragraph tag which contains information about how Google was founded.
<add>
<add># --hints--
<add>
<add>Your code should use the text-align property on the `h4` tag to set it to `center`.
<add>
<add>```js
<add>assert($('h4').css('text-align') == 'center');
<add>```
<add>
<add>Your code should use the text-align property on the `p` tag to set it to `justify`.
<add>
<add>```js
<add>assert($('p').css('text-align') == 'justify');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add>
<add> }
<add> p {
<add>
<add> }
<add> .links {
<add> margin-right: 20px;
<add>
<add> }
<add> .fullCard {
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> margin-right: 20px;
<add>
<add> }
<add> .fullCard {
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.md
<add>---
<add>id: 587d78a7367417b2b2512ae2
<add>title: Create Visual Direction by Fading an Element from Left to Right
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cGJqqAE'
<add>forumTopicId: 301054
<add>dashedName: create-visual-direction-by-fading-an-element-from-left-to-right
<add>---
<add>
<add># --description--
<add>
<add>For this challenge, you'll change the `opacity` of an animated element so it gradually fades as it reaches the right side of the screen.
<add>
<add>In the displayed animation, the round element with the gradient background moves to the right by the 50% mark of the animation per the `@keyframes` rule.
<add>
<add># --instructions--
<add>
<add>Target the element with the id of `ball` and add the `opacity` property set to 0.1 at `50%`, so the element fades as it moves to the right.
<add>
<add># --hints--
<add>
<add>The `keyframes` rule for fade should set the `opacity` property to 0.1 at 50%.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /@keyframes fade\s*?{\s*?50%\s*?{\s*?(?:left:\s*?60%;\s*?opacity:\s*?0?\.1;|opacity:\s*?0?\.1;\s*?left:\s*?60%;)/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add> #ball {
<add> width: 70px;
<add> height: 70px;
<add> margin: 50px auto;
<add> position: fixed;
<add> left: 20%;
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> animation-name: fade;
<add> animation-duration: 3s;
<add> }
<add>
<add> @keyframes fade {
<add> 50% {
<add> left: 60%;
<add>
<add> }
<add> }
<add>
<add></style>
<add>
<add><div id="ball"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #ball {
<add> width: 70px;
<add> height: 70px;
<add> margin: 50px auto;
<add> position: fixed;
<add> left: 20%;
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> animation-name: fade;
<add> animation-duration: 3s;
<add> }
<add>
<add> @keyframes fade {
<add> 50% {
<add> left: 60%;
<add> opacity: 0.1;
<add> }
<add> }
<add></style>
<add><div id="ball"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.md
<add>---
<add>id: 587d781c367417b2b2512abf
<add>title: Decrease the Opacity of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c7aKqu4'
<add>forumTopicId: 301055
<add>dashedName: decrease-the-opacity-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>The `opacity` property in CSS is used to adjust the opacity, or conversely, the transparency for an item.
<add>
<add><blockquote>A value of 1 is opaque, which isn't transparent at all.<br>A value of 0.5 is half see-through.<br>A value of 0 is completely transparent.</blockquote>
<add>
<add>The value given will apply to the entire element, whether that's an image with some transparency, or the foreground and background colors for a block of text.
<add>
<add># --instructions--
<add>
<add>Set the `opacity` of the anchor tags to 0.7 using `links` class to select them.
<add>
<add># --hints--
<add>
<add>Your code should set the `opacity` property to 0.7 on the anchor tags by selecting the class of `links`.
<add>
<add>```js
<add>assert(
<add> /\.links\s*{([\s\S]*?;)*\s*opacity\s*:\s*0*\.70*\s*(;[\s\S]*?|\s*)}/.test(
<add> $('style').text()
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add> font-size: 27px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add>
<add> }
<add> #thumbnail {
<add> box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard" id="thumbnail">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add> font-size: 27px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> opacity: 0.7;
<add> }
<add> #thumbnail {
<add> box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard" id="thumbnail">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.md
<add>---
<add>id: 587d78a3367417b2b2512ad1
<add>title: Learn about Complementary Colors
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MD3Tr'
<add>forumTopicId: 301056
<add>dashedName: learn-about-complementary-colors
<add>---
<add>
<add># --description--
<add>
<add>Color theory and its impact on design is a deep topic and only the basics are covered in the following challenges. On a website, color can draw attention to content, evoke emotions, or create visual harmony. Using different combinations of colors can really change the look of a website, and a lot of thought can go into picking a color palette that works with your content.
<add>
<add>The color wheel is a useful tool to visualize how colors relate to each other - it's a circle where similar hues are neighbors and different hues are farther apart. When two colors are opposite each other on the wheel, they are called complementary colors. They have the characteristic that if they are combined, they "cancel" each other out and create a gray color. However, when placed side-by-side, these colors appear more vibrant and produce a strong visual contrast.
<add>
<add>Some examples of complementary colors with their hex codes are:
<add>
<add><blockquote>red (#FF0000) and cyan (#00FFFF)<br>green (#00FF00) and magenta (#FF00FF)<br>blue (#0000FF) and yellow (#FFFF00)</blockquote>
<add>
<add>This is different than the outdated RYB color model that many of us were taught in school, which has different primary and complementary colors. Modern color theory uses the additive RGB model (like on a computer screen) and the subtractive CMY(K) model (like in printing). Read [here](https://en.wikipedia.org/wiki/Color_model) for more information on this complex subject.
<add>
<add>There are many color picking tools available online that have an option to find the complement of a color.
<add>
<add>**Note:** Using color can be a powerful way to add visual interest to a page. However, color alone should not be used as the only way to convey important information because users with visual impairments may not understand that content. This issue will be covered in more detail in the Applied Accessibility challenges.
<add>
<add># --instructions--
<add>
<add>Change the `background-color` property of the `blue` and `yellow` classes to their respective colors. Notice how the colors look different next to each other than they do compared against the white background.
<add>
<add># --hints--
<add>
<add>The `div` element with class `blue` should have a `background-color` of blue.
<add>
<add>```js
<add>assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
<add>```
<add>
<add>The `div` element with class `yellow` should have a `background-color` of yellow.
<add>
<add>```js
<add>assert($('.yellow').css('background-color') == 'rgb(255, 255, 0)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add> .blue {
<add> background-color: #000000;
<add> }
<add> .yellow {
<add> background-color: #000000;
<add> }
<add> div {
<add> display: inline-block;
<add> height: 100px;
<add> width: 100px;
<add> }
<add></style>
<add><div class="blue"></div>
<add><div class="yellow"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add> .blue {
<add> background-color: blue;
<add> }
<add> .yellow {
<add> background-color: yellow;
<add> }
<add> div {
<add> display: inline-block;
<add> height: 100px;
<add> width: 100px;
<add> }
<add></style>
<add><div class="blue"></div>
<add><div class="yellow"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.md
<add>---
<add>id: 587d78a4367417b2b2512ad2
<add>title: Learn about Tertiary Colors
<add>challengeType: 0
<add>forumTopicId: 301057
<add>dashedName: learn-about-tertiary-colors
<add>---
<add>
<add># --description--
<add>
<add>Computer monitors and device screens create different colors by combining amounts of red, green, and blue light. This is known as the RGB additive color model in modern color theory. Red (R), green (G), and blue (B) are called primary colors. Mixing two primary colors creates the secondary colors cyan (G + B), magenta (R + B) and yellow (R + G). You saw these colors in the Complementary Colors challenge. These secondary colors happen to be the complement to the primary color not used in their creation, and are opposite to that primary color on the color wheel. For example, magenta is made with red and blue, and is the complement to green.
<add>
<add>Tertiary colors are the result of combining a primary color with one of its secondary color neighbors. For example, within the RGB color model, red (primary) and yellow (secondary) make orange (tertiary). This adds six more colors to a simple color wheel for a total of twelve.
<add>
<add>There are various methods of selecting different colors that result in a harmonious combination in design. One example that can use tertiary colors is called the split-complementary color scheme. This scheme starts with a base color, then pairs it with the two colors that are adjacent to its complement. The three colors provide strong visual contrast in a design, but are more subtle than using two complementary colors.
<add>
<add>Here are three colors created using the split-complement scheme:
<add>
<add><table class='table table-striped'><thead><tr><th>Color</th><th>Hex Code</th></tr></thead><thead></thead><tbody><tr><td>orange</td><td>#FF7F00</td></tr><tr><td>cyan</td><td>#00FFFF</td></tr><tr><td>raspberry</td><td>#FF007F</td></tr></tbody></table>
<add>
<add># --instructions--
<add>
<add>Change the `background-color` property of the `orange`, `cyan`, and `raspberry` classes to their respective colors. Make sure to use the hex codes and not the color names.
<add>
<add># --hints--
<add>
<add>The `div` element with class `orange` should have a `background-color` of orange.
<add>
<add>```js
<add>assert($('.orange').css('background-color') == 'rgb(255, 127, 0)');
<add>```
<add>
<add>The `div` element with class `cyan` should have a `background-color` of cyan.
<add>
<add>```js
<add>assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
<add>```
<add>
<add>The `div` element with class `raspberry` should have a `background-color` of raspberry.
<add>
<add>```js
<add>assert($('.raspberry').css('background-color') == 'rgb(255, 0, 127)');
<add>```
<add>
<add>All `background-color` values for the color classes should be hex codes and not color names.
<add>
<add>```js
<add>assert(!/background-color:\s(orange|cyan|raspberry)/.test(code));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add>
<add> .orange {
<add> background-color: #000000;
<add> }
<add>
<add> .cyan {
<add> background-color: #000000;
<add> }
<add>
<add> .raspberry {
<add> background-color: #000000;
<add> }
<add>
<add> div {
<add> height: 100px;
<add> width: 100px;
<add> margin-bottom: 5px;
<add> }
<add></style>
<add>
<add><div class="orange"></div>
<add><div class="cyan"></div>
<add><div class="raspberry"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #FFFFFF;
<add> }
<add>
<add> .orange {
<add> background-color: #FF7F00;
<add> }
<add>
<add> .cyan {
<add> background-color: #00FFFF;
<add> }
<add>
<add> .raspberry {
<add> background-color: #FF007F;
<add> }
<add>
<add> div {
<add> height: 100px;
<add> width: 100px;
<add> margin-bottom: 5px;
<add> }
<add></style>
<add><div class="orange"></div>
<add><div class="cyan"></div>
<add><div class="raspberry"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.md
<add>---
<add>id: 587d78a9367417b2b2512ae8
<add>title: Learn How Bezier Curves Work
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c9bDrs8'
<add>forumTopicId: 301058
<add>dashedName: learn-how-bezier-curves-work
<add>---
<add>
<add># --description--
<add>
<add>The last challenge introduced the `animation-timing-function` property and a few keywords that change the speed of an animation over its duration. CSS offers an option other than keywords that provides even finer control over how the animation plays out, through the use of Bezier curves.
<add>
<add>In CSS animations, Bezier curves are used with the `cubic-bezier` function. The shape of the curve represents how the animation plays out. The curve lives on a 1 by 1 coordinate system. The X-axis of this coordinate system is the duration of the animation (think of it as a time scale), and the Y-axis is the change in the animation.
<add>
<add>The `cubic-bezier` function consists of four main points that sit on this 1 by 1 grid: `p0`, `p1`, `p2`, and `p3`. `p0` and `p3` are set for you - they are the beginning and end points which are always located respectively at the origin (0, 0) and (1, 1). You set the x and y values for the other two points, and where you place them in the grid dictates the shape of the curve for the animation to follow. This is done in CSS by declaring the x and y values of the `p1` and `p2` "anchor" points in the form: `(x1, y1, x2, y2)`. Pulling it all together, here's an example of a Bezier curve in CSS code:
<add>
<add>```css
<add>animation-timing-function: cubic-bezier(0.25, 0.25, 0.75, 0.75);
<add>```
<add>
<add>In the example above, the x and y values are equivalent for each point (x1 = 0.25 = y1 and x2 = 0.75 = y2), which if you remember from geometry class, results in a line that extends from the origin to point (1, 1). This animation is a linear change of an element during the length of an animation, and is the same as using the `linear` keyword. In other words, it changes at a constant speed.
<add>
<add># --instructions--
<add>
<add>For the element with the id of `ball1`, change the value of the `animation-timing-function` property from `linear` to its equivalent `cubic-bezier` function value. Use the point values given in the example above.
<add>
<add># --hints--
<add>
<add>The value of the `animation-timing-function` property for the element with the id `ball1` should be the linear-equivalent `cubic-bezier` function.
<add>
<add>```js
<add>assert(
<add> $('#ball1').css('animation-timing-function') ==
<add> 'cubic-bezier(0.25, 0.25, 0.75, 0.75)'
<add>);
<add>```
<add>
<add>The value of the `animation-timing-function` property for the element with the id `ball2` should not change.
<add>
<add>```js
<add>const ball2Animation = __helpers.removeWhiteSpace(
<add> $('#ball2').css('animation-timing-function')
<add>);
<add>assert(
<add> ball2Animation == 'ease-out' || ball2Animation == 'cubic-bezier(0,0,0.58,1)'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add> .balls{
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #ball1 {
<add> left: 27%;
<add> animation-timing-function: linear;
<add> }
<add> #ball2 {
<add> left: 56%;
<add> animation-timing-function: ease-out;
<add> }
<add>
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add>
<add></style>
<add>
<add><div class="balls" id="ball1"></div>
<add><div class="balls" id="ball2"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add>
<add> .balls{
<add> border-radius: 50%;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #ball1 {
<add> left: 27%;
<add> animation-timing-function: cubic-bezier(0.25, 0.25, 0.75, 0.75);
<add> }
<add> #ball2 {
<add> left: 56%;
<add> animation-timing-function: ease-out;
<add> }
<add>
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add></style>
<add><div class="balls" id="ball1"></div>
<add><div class="balls" id="ball2"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.md
<add>---
<add>id: 587d78a7367417b2b2512adf
<add>title: Learn How the CSS @keyframes and animation Properties Work
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cakprhv'
<add>forumTopicId: 301059
<add>dashedName: learn-how-the-css-keyframes-and-animation-properties-work
<add>---
<add>
<add># --description--
<add>
<add>To animate an element, you need to know about the animation properties and the `@keyframes` rule. The animation properties control how the animation should behave and the `@keyframes` rule controls what happens during that animation. There are eight animation properties in total. This challenge will keep it simple and cover the two most important ones first:
<add>
<add>`animation-name` sets the name of the animation, which is later used by `@keyframes` to tell CSS which rules go with which animations.
<add>
<add>`animation-duration` sets the length of time for the animation.
<add>
<add>`@keyframes` is how to specify exactly what happens within the animation over the duration. This is done by giving CSS properties for specific "frames" during the animation, with percentages ranging from 0% to 100%. If you compare this to a movie, the CSS properties for 0% is how the element displays in the opening scene. The CSS properties for 100% is how the element appears at the end, right before the credits roll. Then CSS applies the magic to transition the element over the given duration to act out the scene. Here's an example to illustrate the usage of `@keyframes` and the animation properties:
<add>
<add>```css
<add>#anim {
<add> animation-name: colorful;
<add> animation-duration: 3s;
<add>}
<add>
<add>@keyframes colorful {
<add> 0% {
<add> background-color: blue;
<add> }
<add> 100% {
<add> background-color: yellow;
<add> }
<add>}
<add>```
<add>
<add>For the element with the `anim` id, the code snippet above sets the `animation-name` to `colorful` and sets the `animation-duration` to 3 seconds. Then the `@keyframes` rule links to the animation properties with the name `colorful`. It sets the color to blue at the beginning of the animation (0%) which will transition to yellow by the end of the animation (100%). You aren't limited to only beginning-end transitions, you can set properties for the element for any percentage between 0% and 100%.
<add>
<add># --instructions--
<add>
<add>Create an animation for the element with the id `rect`, by setting the `animation-name` to `rainbow` and the `animation-duration` to 4 seconds. Next, declare a `@keyframes` rule, and set the `background-color` at the beginning of the animation (`0%`) to blue, the middle of the animation (`50%`) to green, and the end of the animation (`100%`) to yellow.
<add>
<add># --hints--
<add>
<add>The element with id of `rect` should have an `animation-name` property with a value of `rainbow`.
<add>
<add>```js
<add>assert($('#rect').css('animation-name') == 'rainbow');
<add>```
<add>
<add>The element with id of `rect` should have an `animation-duration` property with a value of 4s.
<add>
<add>```js
<add>assert($('#rect').css('animation-duration') == '4s');
<add>```
<add>
<add>The `@keyframes` rule should use the `animation-name` of `rainbow`.
<add>
<add>```js
<add>assert(code.match(/@keyframes\s+?rainbow\s*?{/g));
<add>```
<add>
<add>The `@keyframes` rule for `rainbow` should use a `background-color` of `blue` at 0%.
<add>
<add>```js
<add>assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?}/gi));
<add>```
<add>
<add>The `@keyframes` rule for `rainbow` should use a `background-color` of `green` at 50%.
<add>
<add>```js
<add>assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?}/gi));
<add>```
<add>
<add>The `@keyframes` rule for rainbow should use a `background-color` of `yellow` at 100%.
<add>
<add>```js
<add>assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> height: 40px;
<add> width: 70%;
<add> background: black;
<add> margin: 50px auto;
<add> border-radius: 5px;
<add> }
<add>
<add> #rect {
<add>
<add>
<add> }
<add>
<add>
<add>
<add>
<add></style>
<add><div id="rect"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> height: 40px;
<add> width: 70%;
<add> background: black;
<add> margin: 50px auto;
<add> border-radius: 5px;
<add> }
<add>
<add> #rect {
<add> animation-name: rainbow;
<add> animation-duration: 4s;
<add> }
<add>
<add> @keyframes rainbow {
<add> 0% {
<add> background-color: blue;
<add> }
<add> 50% {
<add> background-color: green;
<add> }
<add> 100% {
<add> background-color: yellow;
<add> }
<add> }
<add></style>
<add><div id="rect"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.md
<add>---
<add>id: 587d781e367417b2b2512acb
<add>title: Lock an Element to its Parent with Absolute Positioning
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cyLJ7c3'
<add>forumTopicId: 301060
<add>dashedName: lock-an-element-to-its-parent-with-absolute-positioning
<add>---
<add>
<add># --description--
<add>
<add>The next option for the CSS `position` property is `absolute`, which locks the element in place relative to its parent container. Unlike the `relative` position, this removes the element from the normal flow of the document, so surrounding items ignore it. The CSS offset properties (top or bottom and left or right) are used to adjust the position.
<add>
<add>One nuance with absolute positioning is that it will be locked relative to its closest *positioned* ancestor. If you forget to add a position rule to the parent item, (this is typically done using `position: relative;`), the browser will keep looking up the chain and ultimately default to the `body` tag.
<add>
<add># --instructions--
<add>
<add>Lock the `#searchbar` element to the top-right of its `section` parent by declaring its `position` as `absolute`. Give it `top` and `right` offsets of 50 pixels each.
<add>
<add># --hints--
<add>
<add>The `#searchbar` element should have a `position` set to `absolute`.
<add>
<add>```js
<add>assert($('#searchbar').css('position') == 'absolute');
<add>```
<add>
<add>Your code should use the `top` CSS offset of 50 pixels on the `#searchbar` element.
<add>
<add>```js
<add>assert($('#searchbar').css('top') == '50px');
<add>```
<add>
<add>Your code should use the `right` CSS offset of 50 pixels on the `#searchbar` element.
<add>
<add>```js
<add>assert($('#searchbar').css('right') == '50px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #searchbar {
<add>
<add>
<add>
<add> }
<add> section {
<add> position: relative;
<add> }
<add></style>
<add><body>
<add> <h1>Welcome!</h1>
<add> <section>
<add> <form id="searchbar">
<add> <label for="search">Search:</label>
<add> <input type="search" id="search" name="search">
<add> <input type="submit" name="submit" value="Go!">
<add> </form>
<add> </section>
<add></body>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #searchbar {
<add> position: absolute;
<add> top: 50px;
<add> right: 50px;
<add> }
<add> section {
<add> position: relative;
<add> }
<add></style>
<add><body>
<add> <h1>Welcome!</h1>
<add> <section>
<add> <form id="searchbar">
<add> <label for="search">Search:</label>
<add> <input type="search" id="search" name="search">
<add> <input type="submit" name="submit" value="Go!">
<add> </form>
<add> </section>
<add></body>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.md
<add>---
<add>id: 587d781e367417b2b2512acc
<add>title: Lock an Element to the Browser Window with Fixed Positioning
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MDNUR'
<add>forumTopicId: 301061
<add>dashedName: lock-an-element-to-the-browser-window-with-fixed-positioning
<add>---
<add>
<add># --description--
<add>
<add>The next layout scheme that CSS offers is the `fixed` position, which is a type of absolute positioning that locks an element relative to the browser window. Similar to absolute positioning, it's used with the CSS offset properties and also removes the element from the normal flow of the document. Other items no longer "realize" where it is positioned, which may require some layout adjustments elsewhere.
<add>
<add>One key difference between the `fixed` and `absolute` positions is that an element with a fixed position won't move when the user scrolls.
<add>
<add># --instructions--
<add>
<add>The navigation bar in the code is labeled with an id of `navbar`. Change its `position` to `fixed`, and offset it 0 pixels from the `top` and 0 pixels from the `left`. After you have added the code, scroll the preview window to see how the navigation stays in place.
<add>
<add># --hints--
<add>
<add>The `#navbar` element should have a `position` set to `fixed`.
<add>
<add>```js
<add>assert($('#navbar').css('position') == 'fixed');
<add>```
<add>
<add>Your code should use the `top` CSS offset of 0 pixels on the `#navbar` element.
<add>
<add>```js
<add>assert($('#navbar').css('top') == '0px');
<add>```
<add>
<add>Your code should use the `left` CSS offset of 0 pixels on the `#navbar` element.
<add>
<add>```js
<add>assert($('#navbar').css('left') == '0px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> min-height: 150vh;
<add> }
<add> #navbar {
<add>
<add>
<add>
<add> width: 100%;
<add> background-color: #767676;
<add> }
<add> nav ul {
<add> margin: 0px;
<add> padding: 5px 0px 5px 30px;
<add> }
<add> nav li {
<add> display: inline;
<add> margin-right: 20px;
<add> }
<add> a {
<add> text-decoration: none;
<add> }
<add></style>
<add><body>
<add> <header>
<add> <h1>Welcome!</h1>
<add> <nav id="navbar">
<add> <ul>
<add> <li><a href="">Home</a></li>
<add> <li><a href="">Contact</a></li>
<add> </ul>
<add> </nav>
<add> </header>
<add> <p>I shift up when the #navbar is fixed to the browser window.</p>
<add></body>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> min-height: 150vh;
<add> }
<add> #navbar {
<add> position: fixed;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> background-color: #767676;
<add> }
<add> nav ul {
<add> margin: 0px;
<add> padding: 5px 0px 5px 30px;
<add> }
<add> nav li {
<add> display: inline;
<add> margin-right: 20px;
<add> }
<add> a {
<add> text-decoration: none;
<add> }
<add></style>
<add><body>
<add> <header>
<add> <h1>Welcome!</h1>
<add> <nav id="navbar">
<add> <ul>
<add> <li><a href="">Home</a></li>
<add> <li><a href="">Contact</a></li>
<add> </ul>
<add> </nav>
<add> </header>
<add> <p>I shift up when the #navbar is fixed to the browser window.</p>
<add></body>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.md
<add>---
<add>id: 587d78a8367417b2b2512ae4
<add>title: Make a CSS Heartbeat using an Infinite Animation Count
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cDZpDUr'
<add>forumTopicId: 301062
<add>dashedName: make-a-css-heartbeat-using-an-infinite-animation-count
<add>---
<add>
<add># --description--
<add>
<add>Here's one more continuous animation example with the `animation-iteration-count` property that uses the heart you designed in a previous challenge.
<add>
<add>The one-second long heartbeat animation consists of two animated pieces. The `heart` elements (including the `:before` and `:after` pieces) are animated to change size using the `transform` property, and the background `div` is animated to change its color using the `background` property.
<add>
<add># --instructions--
<add>
<add>Keep the heart beating by adding the `animation-iteration-count` property for both the `back` class and the `heart` class and setting the value to `infinite`. The `heart:before` and `heart:after` selectors do not need any animation properties.
<add>
<add># --hints--
<add>
<add>The `animation-iteration-count` property for the `heart` class should have a value of `infinite`.
<add>
<add>```js
<add>assert($('.heart').css('animation-iteration-count') == 'infinite');
<add>```
<add>
<add>The `animation-iteration-count` property for the `back` class should have a value of `infinite`.
<add>
<add>```js
<add>assert($('.back').css('animation-iteration-count') == 'infinite');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: white;
<add> animation-name: backdiv;
<add> animation-duration: 1s;
<add>
<add> }
<add>
<add> .heart {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> background-color: pink;
<add> height: 50px;
<add> width: 50px;
<add> transform: rotate(-45deg);
<add> animation-name: beat;
<add> animation-duration: 1s;
<add>
<add> }
<add> .heart:after {
<add> background-color: pink;
<add> content: "";
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: 0px;
<add> left: 25px;
<add> }
<add> .heart:before {
<add> background-color: pink;
<add> content: "";
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: -25px;
<add> left: 0px;
<add> }
<add>
<add> @keyframes backdiv {
<add> 50% {
<add> background: #ffe6f2;
<add> }
<add> }
<add>
<add> @keyframes beat {
<add> 0% {
<add> transform: scale(1) rotate(-45deg);
<add> }
<add> 50% {
<add> transform: scale(0.6) rotate(-45deg);
<add> }
<add> }
<add>
<add></style>
<add><div class="back"></div>
<add><div class="heart"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .back {
<add> position: fixed;
<add> padding: 0;
<add> margin: 0;
<add> top: 0;
<add> left: 0;
<add> width: 100%;
<add> height: 100%;
<add> background: white;
<add> animation-name: backdiv;
<add> animation-duration: 1s;
<add> animation-iteration-count: infinite;
<add> }
<add>
<add> .heart {
<add> position: absolute;
<add> margin: auto;
<add> top: 0;
<add> right: 0;
<add> bottom: 0;
<add> left: 0;
<add> background-color: pink;
<add> height: 50px;
<add> width: 50px;
<add> transform: rotate(-45deg);
<add> animation-name: beat;
<add> animation-duration: 1s;
<add> animation-iteration-count: infinite;
<add> }
<add> .heart:after {
<add> background-color: pink;
<add> content: "";
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: 0px;
<add> left: 25px;
<add> }
<add> .heart:before {
<add> background-color: pink;
<add> content: "";
<add> border-radius: 50%;
<add> position: absolute;
<add> width: 50px;
<add> height: 50px;
<add> top: -25px;
<add> left: 0px;
<add> }
<add>
<add> @keyframes backdiv {
<add> 50% {
<add> background: #ffe6f2;
<add> }
<add> }
<add>
<add> @keyframes beat {
<add> 0% {
<add> transform: scale(1) rotate(-45deg);
<add> }
<add> 50% {
<add> transform: scale(0.6) rotate(-45deg);
<add> }
<add> }
<add></style>
<add><div class="back"></div>
<add><div class="heart"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.md
<add>---
<add>id: 587d78a9367417b2b2512aea
<add>title: Make Motion More Natural Using a Bezier Curve
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c7akWUv'
<add>forumTopicId: 301063
<add>dashedName: make-motion-more-natural-using-a-bezier-curve
<add>---
<add>
<add># --description--
<add>
<add>This challenge animates an element to replicate the movement of a ball being juggled. Prior challenges covered the `linear` and `ease-out` cubic Bezier curves, however neither depicts the juggling movement accurately. You need to customize a Bezier curve for this.
<add>
<add>The `animation-timing-function` automatically loops at every keyframe when the `animation-iteration-count` is set to infinite. Since there is a keyframe rule set in the middle of the animation duration (at `50%`), it results in two identical animation progressions at the upward and downward movement of the ball.
<add>
<add>The following cubic Bezier curve simulates a juggling movement:
<add>
<add>```css
<add>cubic-bezier(0.3, 0.4, 0.5, 1.6);
<add>```
<add>
<add>Notice that the value of y2 is larger than 1. Although the cubic Bezier curve is mapped on a 1 by 1 coordinate system, and it can only accept x values from 0 to 1, the y value can be set to numbers larger than one. This results in a bouncing movement that is ideal for simulating the juggling ball.
<add>
<add># --instructions--
<add>
<add>Change value of the `animation-timing-function` of the element with the id of `green` to a `cubic-bezier` function with x1, y1, x2, y2 values set respectively to 0.311, 0.441, 0.444, 1.649.
<add>
<add># --hints--
<add>
<add>The value of the `animation-timing-function` property for the element with the id `green` should be a `cubic-bezier` function with x1, y1, x2, y2 values as specified.
<add>
<add>```js
<add>assert(
<add> $('#green').css('animation-timing-function') ==
<add> 'cubic-bezier(0.311, 0.441, 0.444, 1.649)'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .balls {
<add> border-radius: 50%;
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> top: 60%;
<add> animation-name: jump;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #red {
<add> background: red;
<add> left: 25%;
<add> animation-timing-function: linear;
<add> }
<add> #blue {
<add> background: blue;
<add> left: 50%;
<add> animation-timing-function: ease-out;
<add> }
<add> #green {
<add> background: green;
<add> left: 75%;
<add> animation-timing-function: cubic-bezier(0.69, 0.1, 1, 0.1);
<add> }
<add>
<add> @keyframes jump {
<add> 50% {
<add> top: 10%;
<add> }
<add> }
<add></style>
<add><div class="balls" id="red"></div>
<add><div class="balls" id="blue"></div>
<add><div class="balls" id="green"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .balls {
<add> border-radius: 50%;
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> top: 60%;
<add> animation-name: jump;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #red {
<add> background: red;
<add> left: 25%;
<add> animation-timing-function: linear;
<add> }
<add> #blue {
<add> background: blue;
<add> left: 50%;
<add> animation-timing-function: ease-out;
<add> }
<add> #green {
<add> background: green;
<add> left: 75%;
<add> animation-timing-function: cubic-bezier(0.311, 0.441, 0.444, 1.649);
<add> }
<add>
<add> @keyframes jump {
<add> 50% {
<add> top: 10%;
<add> }
<add> }
<add></style>
<add><div class="balls" id="red"></div>
<add><div class="balls" id="blue"></div>
<add><div class="balls" id="green"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.md
<add>---
<add>id: 58a7a6ebf9a6318348e2d5aa
<add>title: Modify Fill Mode of an Animation
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cVJDmcE'
<add>forumTopicId: 301064
<add>dashedName: modify-fill-mode-of-an-animation
<add>---
<add>
<add># --description--
<add>
<add>That's great, but it doesn't work right yet. Notice how the animation resets after `500ms` has passed, causing the button to revert back to the original color. You want the button to stay highlighted.
<add>
<add>This can be done by setting the `animation-fill-mode` property to `forwards`. The `animation-fill-mode` specifies the style applied to an element when the animation has finished. You can set it like so:
<add>
<add>```css
<add>animation-fill-mode: forwards;
<add>```
<add>
<add># --instructions--
<add>
<add>Set the `animation-fill-mode` property of `button:hover` to `forwards` so the button stays highlighted when a user hovers over it.
<add>
<add># --hints--
<add>
<add>`button:hover` should have a `animation-fill-mode` property with a value of `forwards`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi
<add> ) &&
<add> code.match(
<add> /button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi
<add> ) &&
<add> code.match(
<add> /button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> button {
<add> border-radius: 5px;
<add> color: white;
<add> background-color: #0F5897;
<add> padding: 5px 10px 8px 10px;
<add> }
<add> button:hover {
<add> animation-name: background-color;
<add> animation-duration: 500ms;
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> }
<add> @keyframes background-color {
<add> 100% {
<add> background-color: #4791d0;
<add> }
<add> }
<add></style>
<add><button>Register</button>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> button {
<add> border-radius: 5px;
<add> color: white;
<add> background-color: #0F5897;
<add> padding: 5px 10px 8px 10px;
<add> }
<add> button:hover {
<add> animation-name: background-color;
<add> animation-duration: 500ms;
<add> animation-fill-mode: forwards;
<add> }
<add> @keyframes background-color {
<add> 100% {
<add> background-color: #4791d0;
<add> }
<add> }
<add></style>
<add><button>Register</button>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md
<add>---
<add>id: 587d781e367417b2b2512aca
<add>title: Move a Relatively Positioned Element with CSS Offsets
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c9bQEA4'
<add>forumTopicId: 301065
<add>dashedName: move-a-relatively-positioned-element-with-css-offsets
<add>---
<add>
<add># --description--
<add>
<add>The CSS offsets of `top` or `bottom`, and `left` or `right` tell the browser how far to offset an item relative to where it would sit in the normal flow of the document. You're offsetting an element away from a given spot, which moves the element away from the referenced side (effectively, the opposite direction). As you saw in the last challenge, using the `top` offset moved the `h2` downwards. Likewise, using a `left` offset moves an item to the right.
<add>
<add><img src='https://cdn-media-1.freecodecamp.org/imgr/eWWi3gZ.gif' alt=''>
<add>
<add># --instructions--
<add>
<add>Use CSS offsets to move the `h2` 15 pixels to the right and 10 pixels up.
<add>
<add># --hints--
<add>
<add>Your code should use a CSS offset to relatively position the `h2` 10px upwards. In other words, move it 10px away from the `bottom` of where it normally sits.
<add>
<add>```js
<add>assert($('h2').css('bottom') == '10px');
<add>```
<add>
<add>Your code should use a CSS offset to relatively position the `h2` 15px towards the right. In other words, move it 15px away from the `left` of where it normally sits.
<add>
<add>```js
<add>assert($('h2').css('left') == '15px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><head>
<add><style>
<add> h2 {
<add> position: relative;
<add>
<add>
<add> }
<add></style>
<add></head>
<add><body>
<add> <h1>On Being Well-Positioned</h1>
<add> <h2>Move me!</h2>
<add> <p>I still think the h2 is where it normally sits.</p>
<add></body>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><head>
<add><style>
<add> h2 {
<add> position: relative;
<add> left: 15px;
<add> bottom: 10px;
<add> }
<add></style>
<add></head>
<add><body>
<add> <h1>On Being Well-Positioned</h1>
<add> <h2>Move me!</h2>
<add> <p>I still think the h2 is where it normally sits.</p>
<add></body>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.md
<add>---
<add>id: 587d78a3367417b2b2512ace
<add>title: Push Elements Left or Right with the float Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MDqu2'
<add>forumTopicId: 301066
<add>dashedName: push-elements-left-or-right-with-the-float-property
<add>---
<add>
<add># --description--
<add>
<add>The next positioning tool does not actually use `position`, but sets the `float` property of an element. Floating elements are removed from the normal flow of a document and pushed to either the `left` or `right` of their containing parent element. It's commonly used with the `width` property to specify how much horizontal space the floated element requires.
<add>
<add># --instructions--
<add>
<add>The given markup would work well as a two-column layout, with the `section` and `aside` elements next to each other. Give the `#left` item a `float` of `left` and the `#right` item a `float` of `right`.
<add>
<add># --hints--
<add>
<add>The element with id `left` should have a `float` value of `left`.
<add>
<add>```js
<add>assert($('#left').css('float') == 'left');
<add>```
<add>
<add>The element with id `right` should have a `float` value of `right`.
<add>
<add>```js
<add>assert($('#right').css('float') == 'right');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><head>
<add> <style>
<add> #left {
<add>
<add> width: 50%;
<add> }
<add> #right {
<add>
<add> width: 40%;
<add> }
<add> aside, section {
<add> padding: 2px;
<add> background-color: #ccc;
<add> }
<add> </style>
<add></head>
<add><body>
<add> <header>
<add> <h1>Welcome!</h1>
<add> </header>
<add> <section id="left">
<add> <h2>Content</h2>
<add> <p>Good stuff</p>
<add> </section>
<add> <aside id="right">
<add> <h2>Sidebar</h2>
<add> <p>Links</p>
<add> </aside>
<add></body>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><head>
<add> <style>
<add> #left {
<add> float: left;
<add> width: 50%;
<add> }
<add> #right {
<add> float: right;
<add> width: 40%;
<add> }
<add> aside, section {
<add> padding: 2px;
<add> background-color: #ccc;
<add> }
<add> </style>
<add></head>
<add><body>
<add> <header>
<add> <h1>Welcome!</h1>
<add> </header>
<add> <section id="left">
<add> <h2>Content</h2>
<add> <p>Good stuff</p>
<add> </section>
<add> <aside id="right">
<add> <h2>Sidebar</h2>
<add> <p>Links</p>
<add> </aside>
<add></body>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.md
<add>---
<add>id: 587d781c367417b2b2512ac2
<add>title: Set the font-size for Multiple Heading Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cPpQNT3'
<add>forumTopicId: 301067
<add>dashedName: set-the-font-size-for-multiple-heading-elements
<add>---
<add>
<add># --description--
<add>
<add>The `font-size` property is used to specify how large the text is in a given element. This rule can be used for multiple elements to create visual consistency of text on a page. In this challenge, you'll set the values for all `h1` through `h6` tags to balance the heading sizes.
<add>
<add># --instructions--
<add>
<add> <p>In the <code>style</code> tags, set the <code>font-size</code> of the:</p>
<add>
<add> <ul>
<add> <li><code>h1</code> tag to 68px.</li>
<add> <li><code>h2</code> tag to 52px.</li>
<add> <li><code>h3</code> tag to 40px.</li>
<add> <li><code>h4</code> tag to 32px.</li>
<add> <li><code>h5</code> tag to 21px.</li>
<add> <li><code>h6</code> tag to 14px.</li>
<add> </ul>
<add>
<add># --hints--
<add>
<add>Your code should set the `font-size` property for the `h1` tag to 68 pixels.
<add>
<add>```js
<add>assert($('h1').css('font-size') == '68px');
<add>```
<add>
<add>Your code should set the `font-size` property for the `h2` tag to 52 pixels.
<add>
<add>```js
<add>assert($('h2').css('font-size') == '52px');
<add>```
<add>
<add>Your code should set the `font-size` property for the `h3` tag to 40 pixels.
<add>
<add>```js
<add>assert($('h3').css('font-size') == '40px');
<add>```
<add>
<add>Your code should set the `font-size` property for the `h4` tag to 32 pixels.
<add>
<add>```js
<add>assert($('h4').css('font-size') == '32px');
<add>```
<add>
<add>Your code should set the `font-size` property for the `h5` tag to 21 pixels.
<add>
<add>```js
<add>assert($('h5').css('font-size') == '21px');
<add>```
<add>
<add>Your code should set the `font-size` property for the `h6` tag to 14 pixels.
<add>
<add>```js
<add>const regex = /h6\s*\{\s*font-size\s*:\s*14px\s*(;\s*\}|\})/i;
<add>assert.strictEqual(true, regex.test(code));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add>
<add>
<add>
<add>
<add>
<add></style>
<add><h1>This is h1 text</h1>
<add><h2>This is h2 text</h2>
<add><h3>This is h3 text</h3>
<add><h4>This is h4 text</h4>
<add><h5>This is h5 text</h5>
<add><h6>This is h6 text</h6>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h1 {
<add> font-size: 68px;
<add> }
<add> h2 {
<add> font-size: 52px;
<add> }
<add> h3 {
<add> font-size: 40px;
<add> }
<add> h4 {
<add> font-size: 32px;
<add> }
<add> h5 {
<add> font-size: 21px;
<add> }
<add> h6 {
<add> font-size: 14px;
<add> }
<add></style>
<add><h1>This is h1 text</h1>
<add><h2>This is h2 text</h2>
<add><h3>This is h3 text</h3>
<add><h4>This is h4 text</h4>
<add><h5>This is h5 text</h5>
<add><h6>This is h6 text</h6>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.md
<add>---
<add>id: 587d781c367417b2b2512ac4
<add>title: Set the font-size of Paragraph Text
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cVJ36Cr'
<add>forumTopicId: 301068
<add>dashedName: set-the-font-size-of-paragraph-text
<add>---
<add>
<add># --description--
<add>
<add>The `font-size` property in CSS is not limited to headings, it can be applied to any element containing text.
<add>
<add># --instructions--
<add>
<add>Change the value of the `font-size` property for the paragraph to 16px to make it more visible.
<add>
<add># --hints--
<add>
<add>Your `p` tag should have a `font-size` of 16 pixels.
<add>
<add>```js
<add>assert($('p').css('font-size') == '16px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> p {
<add> font-size: 10px;
<add> }
<add></style>
<add><p>
<add> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<add></p>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> p {
<add> font-size: 16px;
<add> }
<add></style>
<add><p>
<add> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<add></p>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.md
<add>---
<add>id: 587d781c367417b2b2512ac3
<add>title: Set the font-weight for Multiple Heading Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/crVWRHq'
<add>forumTopicId: 301069
<add>dashedName: set-the-font-weight-for-multiple-heading-elements
<add>---
<add>
<add># --description--
<add>
<add>You set the `font-size` of each heading tag in the last challenge, here you'll adjust the `font-weight`.
<add>
<add>The `font-weight` property sets how thick or thin characters are in a section of text.
<add>
<add># --instructions--
<add>
<add><ul><li>Set the <code>font-weight</code> of the <code>h1</code> tag to 800.</li><li>Set the <code>font-weight</code> of the <code>h2</code> tag to 600.</li><li>Set the <code>font-weight</code> of the <code>h3</code> tag to 500.</li><li>Set the <code>font-weight</code> of the <code>h4</code> tag to 400.</li><li>Set the <code>font-weight</code> of the <code>h5</code> tag to 300.</li><li>Set the <code>font-weight</code> of the <code>h6</code> tag to 200.</li></ul>
<add>
<add># --hints--
<add>
<add>Your code should set the `font-weight` property for the `h1` tag to 800.
<add>
<add>```js
<add>assert($('h1').css('font-weight') == '800');
<add>```
<add>
<add>Your code should set the `font-weight` property for the `h2` tag to 600.
<add>
<add>```js
<add>assert($('h2').css('font-weight') == '600');
<add>```
<add>
<add>Your code should set the `font-weight` property for the `h3` tag to 500.
<add>
<add>```js
<add>assert($('h3').css('font-weight') == '500');
<add>```
<add>
<add>Your code should set the `font-weight` property for the `h4` tag to 400.
<add>
<add>```js
<add>assert($('h4').css('font-weight') == '400');
<add>```
<add>
<add>Your code should set the `font-weight` property for the `h5` tag to 300.
<add>
<add>```js
<add>assert($('h5').css('font-weight') == '300');
<add>```
<add>
<add>Your code should set the `font-weight` property for the `h6` tag to 200.
<add>
<add>```js
<add>assert($('h6').css('font-weight') == '200');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h1 {
<add> font-size: 68px;
<add>
<add> }
<add> h2 {
<add> font-size: 52px;
<add>
<add> }
<add> h3 {
<add> font-size: 40px;
<add>
<add> }
<add> h4 {
<add> font-size: 32px;
<add>
<add> }
<add> h5 {
<add> font-size: 21px;
<add>
<add> }
<add> h6 {
<add> font-size: 14px;
<add>
<add> }
<add></style>
<add><h1>This is h1 text</h1>
<add><h2>This is h2 text</h2>
<add><h3>This is h3 text</h3>
<add><h4>This is h4 text</h4>
<add><h5>This is h5 text</h5>
<add><h6>This is h6 text</h6>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h1 {
<add> font-size: 68px;
<add> font-weight: 800;
<add> }
<add> h2 {
<add> font-size: 52px;
<add> font-weight: 600;
<add> }
<add> h3 {
<add> font-size: 40px;
<add> font-weight: 500;
<add> }
<add> h4 {
<add> font-size: 32px;
<add> font-weight: 400;
<add> }
<add> h5 {
<add> font-size: 21px;
<add> font-weight: 300;
<add> }
<add> h6 {
<add> font-size: 14px;
<add> font-weight: 200;
<add> }
<add></style>
<add><h1>This is h1 text</h1>
<add><h2>This is h2 text</h2>
<add><h3>This is h3 text</h3>
<add><h4>This is h4 text</h4>
<add><h5>This is h5 text</h5>
<add><h6>This is h6 text</h6>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.md
<add>---
<add>id: 587d781d367417b2b2512ac5
<add>title: Set the line-height of Paragraphs
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/crVWdcv'
<add>forumTopicId: 301070
<add>dashedName: set-the-line-height-of-paragraphs
<add>---
<add>
<add># --description--
<add>
<add>CSS offers the `line-height` property to change the height of each line in a block of text. As the name suggests, it changes the amount of vertical space that each line of text gets.
<add>
<add># --instructions--
<add>
<add>Add a `line-height` property to the `p` tag and set it to 25px.
<add>
<add># --hints--
<add>
<add>Your code should set the `line-height` of the `p` tag to 25 pixels.
<add>
<add>```js
<add>assert($('p').css('line-height') == '25px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> p {
<add> font-size: 16px;
<add>
<add> }
<add></style>
<add><p>
<add> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<add></p>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> p {
<add> font-size: 16px;
<add> line-height: 25px;
<add> }
<add></style>
<add><p>
<add> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<add></p>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.md
<add>---
<add>id: 587d78a9367417b2b2512ae9
<add>title: Use a Bezier Curve to Move a Graphic
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c6bnRCK'
<add>forumTopicId: 301071
<add>dashedName: use-a-bezier-curve-to-move-a-graphic
<add>---
<add>
<add># --description--
<add>
<add>A previous challenge discussed the `ease-out` keyword that describes an animation change that speeds up first and then slows down at the end of the animation. On the right, the difference between the `ease-out` keyword (for the blue element) and `linear` keyword (for the red element) is demonstrated. Similar animation progressions to the `ease-out` keyword can be achieved by using a custom cubic Bezier curve function.
<add>
<add>In general, changing the `p1` and `p2` anchor points drives the creation of different Bezier curves, which controls how the animation progresses through time. Here's an example of a Bezier curve using values to mimic the ease-out style:
<add>
<add>```css
<add>animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
<add>```
<add>
<add>Remember that all `cubic-bezier` functions start with `p0` at (0, 0) and end with `p3` at (1, 1). In this example, the curve moves faster through the Y-axis (starts at 0, goes to `p1` y value of 0, then goes to `p2` y value of 1) than it moves through the X-axis (0 to start, then 0 for `p1`, up to 0.58 for `p2`). As a result, the change in the animated element progresses faster than the time of the animation for that segment. Towards the end of the curve, the relationship between the change in x and y values reverses - the y value moves from 1 to 1 (no change), and the x values move from 0.58 to 1, making the animation changes progress slower compared to the animation duration.
<add>
<add># --instructions--
<add>
<add>To see the effect of this Bezier curve in action, change the `animation-timing-function` of the element with id of `red` to a `cubic-bezier` function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1. This will make both elements progress through the animation similarly.
<add>
<add># --hints--
<add>
<add>The value of the `animation-timing-function` property of the element with the id `red` should be a `cubic-bezier` function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1 .
<add>
<add>```js
<add>assert(
<add> $('#red').css('animation-timing-function') == 'cubic-bezier(0, 0, 0.58, 1)'
<add>);
<add>```
<add>
<add>The element with the id `red` should no longer have the `animation-timing-function` property of `linear`.
<add>
<add>```js
<add>assert($('#red').css('animation-timing-function') !== 'linear');
<add>```
<add>
<add>The value of the `animation-timing-function` property for the element with the id `blue` should not change.
<add>
<add>```js
<add>const blueBallAnimation = __helpers.removeWhiteSpace(
<add> $('#blue').css('animation-timing-function')
<add>);
<add>assert(
<add> blueBallAnimation == 'ease-out' ||
<add> blueBallAnimation == 'cubic-bezier(0,0,0.58,1)'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .balls{
<add> border-radius: 50%;
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #red {
<add> background: red;
<add> left: 27%;
<add> animation-timing-function: linear;
<add> }
<add> #blue {
<add> background: blue;
<add> left: 56%;
<add> animation-timing-function: ease-out;
<add> }
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add></style>
<add><div class="balls" id= "red"></div>
<add><div class="balls" id= "blue"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .balls{
<add> border-radius: 50%;
<add> position: fixed;
<add> width: 50px;
<add> height: 50px;
<add> margin-top: 50px;
<add> animation-name: bounce;
<add> animation-duration: 2s;
<add> animation-iteration-count: infinite;
<add> }
<add> #red {
<add> background: red;
<add> left: 27%;
<add> animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
<add> }
<add> #blue {
<add> background: blue;
<add> left: 56%;
<add> animation-timing-function: ease-out;
<add> }
<add> @keyframes bounce {
<add> 0% {
<add> top: 0px;
<add> }
<add> 100% {
<add> top: 249px;
<add> }
<add> }
<add></style>
<add><div class="balls" id= "red"></div>
<add><div class="balls" id= "blue"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.md
<add>---
<add>id: 587d78a5367417b2b2512ad7
<add>title: Use a CSS Linear Gradient to Create a Striped Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c6bmQh2'
<add>forumTopicId: 301072
<add>dashedName: use-a-css-linear-gradient-to-create-a-striped-element
<add>---
<add>
<add># --description--
<add>
<add>The `repeating-linear-gradient()` function is very similar to `linear-gradient()` with the major difference that it repeats the specified gradient pattern. `repeating-linear-gradient()` accepts a variety of values, but for simplicity, you'll work with an angle value and color stop values in this challenge.
<add>
<add>The angle value is the direction of the gradient. Color stops are like width values that mark where a transition takes place, and are given with a percentage or a number of pixels.
<add>
<add>In the example demonstrated in the code editor, the gradient starts with the color `yellow` at 0 pixels which blends into the second color `blue` at 40 pixels away from the start. Since the next color stop is also at 40 pixels, the gradient immediately changes to the third color `green`, which itself blends into the fourth color value `red` as that is 80 pixels away from the beginning of the gradient.
<add>
<add>For this example, it helps to think about the color stops as pairs where every two colors blend together.
<add>
<add>```css
<add>0px [yellow -- blend -- blue] 40px [green -- blend -- red] 80px
<add>```
<add>
<add>If every two color stop values are the same color, the blending isn't noticeable because it's between the same color, followed by a hard transition to the next color, so you end up with stripes.
<add>
<add># --instructions--
<add>
<add>Make stripes by changing the `repeating-linear-gradient()` to use a gradient angle of `45deg`, then set the first two color stops to `yellow`, and finally the second two color stops to `black`.
<add>
<add># --hints--
<add>
<add>The angle of the `repeating-linear-gradient()` should be 45deg.
<add>
<add>```js
<add>assert(code.match(/background:\s*?repeating-linear-gradient\(\s*?45deg/gi));
<add>```
<add>
<add>The angle of the `repeating-linear-gradient()` should no longer be 90deg
<add>
<add>```js
<add>assert(!code.match(/90deg/gi));
<add>```
<add>
<add>The color stop at 0 pixels should be `yellow`.
<add>
<add>```js
<add>assert(code.match(/yellow\s+?0(px)?/gi));
<add>```
<add>
<add>One color stop at 40 pixels should be `yellow`.
<add>
<add>```js
<add>assert(code.match(/yellow\s+?40px/gi));
<add>```
<add>
<add>The second color stop at 40 pixels should be `black`.
<add>
<add>```js
<add>assert(code.match(/yellow\s+?40px,\s*?black\s+?40px/gi));
<add>```
<add>
<add>The last color stop at 80 pixels should be `black`.
<add>
<add>```js
<add>assert(code.match(/black\s+?80px/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add> div{
<add> border-radius: 20px;
<add> width: 70%;
<add> height: 400px;
<add> margin: 50 auto;
<add> background: repeating-linear-gradient(
<add> 90deg,
<add> yellow 0px,
<add> blue 40px,
<add> green 40px,
<add> red 80px
<add> );
<add> }
<add>
<add></style>
<add>
<add><div></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div{
<add> border-radius: 20px;
<add> width: 70%;
<add> height: 400px;
<add> margin: 50 auto;
<add> background: repeating-linear-gradient(
<add> 45deg,
<add> yellow 0px,
<add> yellow 40px,
<add> black 40px,
<add> black 80px
<add> );
<add> }
<add></style>
<add><div></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.md
<add>---
<add>id: 587d78a7367417b2b2512ae0
<add>title: Use CSS Animation to Change the Hover State of a Button
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cg4vZAa'
<add>forumTopicId: 301073
<add>dashedName: use-css-animation-to-change-the-hover-state-of-a-button
<add>---
<add>
<add># --description--
<add>
<add>You can use CSS `@keyframes` to change the color of a button in its hover state.
<add>
<add>Here's an example of changing the width of an image on hover:
<add>
<add>```html
<add><style>
<add> img:hover {
<add> animation-name: width;
<add> animation-duration: 500ms;
<add> }
<add>
<add> @keyframes width {
<add> 100% {
<add> width: 40px;
<add> }
<add> }
<add></style>
<add>
<add><img src="https://bit.ly/smallgooglelogo" alt="Google's Logo" />
<add>```
<add>
<add># --instructions--
<add>
<add>Note that `ms` stands for milliseconds, where 1000ms is equal to 1s.
<add>
<add>Use CSS `@keyframes` to change the `background-color` of the `button` element so it becomes `#4791d0` when a user hovers over it. The `@keyframes` rule should only have an entry for `100%`.
<add>
<add># --hints--
<add>
<add>The @keyframes rule should use the `animation-name` background-color.
<add>
<add>```js
<add>assert(code.match(/@keyframes\s+?background-color\s*?{/g));
<add>```
<add>
<add>There should be one rule under `@keyframes` that changes the `background-color` to `#4791d0` at 100%.
<add>
<add>```js
<add>assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> button {
<add> border-radius: 5px;
<add> color: white;
<add> background-color: #0F5897;
<add> padding: 5px 10px 8px 10px;
<add> }
<add>
<add> button:hover {
<add> animation-name: background-color;
<add> animation-duration: 500ms;
<add> }
<add>
<add>
<add></style>
<add>
<add><button>Register</button>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> button {
<add> border-radius: 5px;
<add> color: white;
<add> background-color: #0F5897;
<add> padding: 5px 10px 8px 10px;
<add> }
<add>
<add> button:hover {
<add> animation-name: background-color;
<add> animation-duration: 500ms;
<add> }
<add>
<add> @keyframes background-color {
<add> 100% {
<add> background-color: #4791d0;
<add> }
<add> }
<add></style>
<add><button>Register</button>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.md
<add>---
<add>id: 587d78a6367417b2b2512adb
<add>title: Use the CSS Transform Property skewX to Skew an Element Along the X-Axis
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cyLP8Sr'
<add>forumTopicId: 301074
<add>dashedName: use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis
<add>---
<add>
<add># --description--
<add>
<add>The next function of the `transform` property is `skewX()`, which skews the selected element along its X (horizontal) axis by a given degree.
<add>
<add>The following code skews the paragraph element by -32 degrees along the X-axis.
<add>
<add>```css
<add>p {
<add> transform: skewX(-32deg);
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Skew the element with the id of `bottom` by 24 degrees along the X-axis by using the `transform` property.
<add>
<add># --hints--
<add>
<add>The element with id `bottom` should be skewed by 24 degrees along its X-axis.
<add>
<add>```js
<add>assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> }
<add> #top {
<add> background-color: red;
<add> }
<add> #bottom {
<add> background-color: blue;
<add>
<add> }
<add></style>
<add>
<add><div id="top"></div>
<add><div id="bottom"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> }
<add> #top {
<add> background-color: red;
<add> }
<add> #bottom {
<add> background-color: blue;
<add> transform: skewX(24deg);
<add> }
<add></style>
<add><div id="top"></div>
<add><div id="bottom"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.md
<add>---
<add>id: 587d78a6367417b2b2512adc
<add>title: Use the CSS Transform Property skewY to Skew an Element Along the Y-Axis
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MZ2uB'
<add>forumTopicId: 301075
<add>dashedName: use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis
<add>---
<add>
<add># --description--
<add>
<add>Given that the `skewX()` function skews the selected element along the X-axis by a given degree, it is no surprise that the `skewY()` property skews an element along the Y (vertical) axis.
<add>
<add># --instructions--
<add>
<add>Skew the element with the id of `top` -10 degrees along the Y-axis by using the `transform` property.
<add>
<add># --hints--
<add>
<add>The element with id `top` should be skewed by -10 degrees along its Y-axis.
<add>
<add>```js
<add>assert(code.match(/#top\s*?{\s*?.*?\s*?transform:\s*?skewY\(-10deg\);/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> }
<add> #top {
<add> background-color: red;
<add>
<add> }
<add> #bottom {
<add> background-color: blue;
<add> transform: skewX(24deg);
<add> }
<add></style>
<add>
<add><div id="top"></div>
<add><div id="bottom"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> }
<add> #top {
<add> background-color: red;
<add> transform: skewY(-10deg);
<add> }
<add> #bottom {
<add> background-color: blue;
<add> transform: skewX(24deg);
<add> }
<add></style>
<add><div id="top"></div>
<add><div id="bottom"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.md
<add>---
<add>id: 587d78a5367417b2b2512ad9
<add>title: Use the CSS Transform scale Property to Change the Size of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MZVSg'
<add>forumTopicId: 301076
<add>dashedName: use-the-css-transform-scale-property-to-change-the-size-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>To change the scale of an element, CSS has the `transform` property, along with its `scale()` function. The following code example doubles the size of all the paragraph elements on the page:
<add>
<add>```css
<add>p {
<add> transform: scale(2);
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Increase the size of the element with the id of `ball2` to 1.5 times its original size.
<add>
<add># --hints--
<add>
<add>The `transform` property for `#ball2` should be set to scale it to 1.5 times its size.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .ball {
<add> width: 40px;
<add> height: 40px;
<add> margin: 50 auto;
<add> position: fixed;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> border-radius: 50%;
<add> }
<add> #ball1 {
<add> left: 20%;
<add> }
<add> #ball2 {
<add> left: 65%;
<add>
<add> }
<add>
<add>
<add></style>
<add>
<add><div class="ball" id= "ball1"></div>
<add><div class="ball" id= "ball2"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .ball {
<add> width: 40px;
<add> height: 40px;
<add> margin: 50 auto;
<add> position: fixed;
<add> background: linear-gradient(
<add> 35deg,
<add> #ccffff,
<add> #ffcccc
<add> );
<add> border-radius: 50%;
<add> }
<add> #ball1 {
<add> left: 20%;
<add> }
<add> #ball2 {
<add> left: 65%;
<add> transform: scale(1.5);
<add> }
<add></style>
<add><div class="ball" id= "ball1"></div>
<add><div class="ball" id= "ball2"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.md
<add>---
<add>id: 587d78a5367417b2b2512ada
<add>title: Use the CSS Transform scale Property to Scale an Element on Hover
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cyLPJuM'
<add>forumTopicId: 301077
<add>dashedName: use-the-css-transform-scale-property-to-scale-an-element-on-hover
<add>---
<add>
<add># --description--
<add>
<add>The `transform` property has a variety of functions that let you scale, move, rotate, skew, etc., your elements. When used with pseudo-classes such as `:hover` that specify a certain state of an element, the `transform` property can easily add interactivity to your elements.
<add>
<add>Here's an example to scale the paragraph elements to 2.1 times their original size when a user hovers over them:
<add>
<add>```css
<add>p:hover {
<add> transform: scale(2.1);
<add>}
<add>```
<add>
<add>**Note:** Applying a transform to a `div` element will also affect any child elements contained in the div.
<add>
<add># --instructions--
<add>
<add>Add a CSS rule for the `hover` state of the `div` and use the `transform` property to scale the `div` element to 1.1 times its original size when a user hovers over it.
<add>
<add># --hints--
<add>
<add>The size of the `div` element should scale 1.1 times when the user hovers over it.
<add>
<add>```js
<add>assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> background: linear-gradient(
<add> 53deg,
<add> #ccfffc,
<add> #ffcccf
<add> );
<add> }
<add>
<add>
<add>
<add></style>
<add>
<add><div></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> div {
<add> width: 70%;
<add> height: 100px;
<add> margin: 50px auto;
<add> background: linear-gradient(
<add> 53deg,
<add> #ccfffc,
<add> #ffcccf
<add> );
<add> }
<add> div:hover {
<add> transform: scale(1.1);
<add> }
<add></style>
<add><div></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.md
<add>---
<add>id: 587d781a367417b2b2512ab9
<add>title: Use the em Tag to Italicize Text
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cVJRBtp'
<add>forumTopicId: 301078
<add>dashedName: use-the-em-tag-to-italicize-text
<add>---
<add>
<add># --description--
<add>
<add>To emphasize text, you can use the `em` tag. This displays text as italicized, as the browser applies the CSS of `font-style: italic;` to the element.
<add>
<add># --instructions--
<add>
<add>Wrap an `em` tag around the contents of the paragraph tag to give it emphasis.
<add>
<add># --hints--
<add>
<add>Your code should add an `em` tag to the markup.
<add>
<add>```js
<add>assert($('em').length == 1);
<add>```
<add>
<add>The `em` tag should wrap around the contents of the `p` tag but not the `p` tag itself.
<add>
<add>```js
<add>assert($('p').children().length == 1 && $('em').children().length == 2);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.md
<add>---
<add>id: 587d781b367417b2b2512aba
<add>title: Use the s Tag to Strikethrough Text
<add>challengeType: 0
<add>videoUrl: ''
<add>forumTopicId: 301079
<add>dashedName: use-the-s-tag-to-strikethrough-text
<add>---
<add>
<add># --description--
<add>
<add>To strikethrough text, which is when a horizontal line cuts across the characters, you can use the `s` tag. It shows that a section of text is no longer valid. With the `s` tag, the browser applies the CSS of `text-decoration: line-through;` to the element.
<add>
<add># --instructions--
<add>
<add>Wrap the `s` tag around `Google` inside the `h4` tag and then add the word `Alphabet` beside it, which should not have the strikethrough formatting.
<add>
<add># --hints--
<add>
<add>Your code should add one `s` tag to the markup.
<add>
<add>```js
<add>assert($('s').length == 1);
<add>```
<add>
<add>A `s` tag should wrap around the `Google` text in the `h4` tag. It should not contain the word `Alphabet`.
<add>
<add>```js
<add>assert(
<add> $('h4 > s')
<add> .text()
<add> .match(/Google/gi) &&
<add> !$('h4 > s')
<add> .text()
<add> .match(/Alphabet/gi)
<add>);
<add>```
<add>
<add>You should include the word `Alphabet` in the `h4` tag, without strikethrough formatting.
<add>
<add>```js
<add>assert(
<add> $('h4')
<add> .html()
<add> .match(/Alphabet/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4><s>Google</s> Alphabet</h4>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.md
<add>---
<add>id: 587d781a367417b2b2512ab7
<add>title: Use the strong Tag to Make Text Bold
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/ceJNBSb'
<add>forumTopicId: 301080
<add>dashedName: use-the-strong-tag-to-make-text-bold
<add>---
<add>
<add># --description--
<add>
<add>To make text bold, you can use the `strong` tag. This is often used to draw attention to text and symbolize that it is important. With the `strong` tag, the browser applies the CSS of `font-weight: bold;` to the element.
<add>
<add># --instructions--
<add>
<add>Wrap a `strong` tag around `Stanford University` text inside the `p` tag (do not include the period).
<add>
<add># --hints--
<add>
<add>Your code should add one `strong` tag to the markup.
<add>
<add>```js
<add>assert($('strong').length == 1);
<add>```
<add>
<add>The `strong` tag should be inside the `p` tag.
<add>
<add>```js
<add>assert($('p').children('strong').length == 1);
<add>```
<add>
<add>The `strong` tag should wrap around the words `Stanford University`.
<add>
<add>```js
<add>assert(
<add> $('strong')
<add> .text()
<add> .match(/^Stanford University\.?$/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at <strong>Stanford University</strong>.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.md
<add>---
<add>id: 587d781c367417b2b2512ac0
<add>title: Use the text-transform Property to Make Text Uppercase
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cvVZQSP'
<add>forumTopicId: 301081
<add>dashedName: use-the-text-transform-property-to-make-text-uppercase
<add>---
<add>
<add># --description--
<add>
<add>The `text-transform` property in CSS is used to change the appearance of text. It's a convenient way to make sure text on a webpage appears consistently, without having to change the text content of the actual HTML elements.
<add>
<add>The following table shows how the different `text-transform`values change the example text "Transform me".
<add>
<add><table class='table table-striped'><thead><tr><th>Value</th><th>Result</th></tr></thead><tbody><tr><td><code>lowercase</code></td><td>"transform me"</td></tr><tr><td><code>uppercase</code></td><td>"TRANSFORM ME"</td></tr><tr><td><code>capitalize</code></td><td>"Transform Me"</td></tr><tr><td><code>initial</code></td><td>Use the default value</td></tr><tr><td><code>inherit</code></td><td>Use the <code>text-transform</code> value from the parent element</td></tr><tr><td><code>none</code></td><td><strong>Default:</strong> Use the original text</td></tr></tbody></table>
<add>
<add># --instructions--
<add>
<add>Transform the text of the `h4` to be uppercase using the `text-transform` property.
<add>
<add># --hints--
<add>
<add>The `h4` text should be `uppercase`.
<add>
<add>```js
<add>assert($('h4').css('text-transform') === 'uppercase');
<add>```
<add>
<add>The original text of the h4 should not be changed.
<add>
<add>```js
<add>assert($('h4').text() !== $('h4').text().toUpperCase());
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add> font-size: 27px;
<add>
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> opacity: 0.7;
<add> }
<add> #thumbnail {
<add> box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard" id="thumbnail">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> background-color: rgba(45, 45, 45, 0.1);
<add> padding: 10px;
<add> font-size: 27px;
<add> text-transform: uppercase;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> opacity: 0.7;
<add> }
<add> #thumbnail {
<add> box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard" id="thumbnail">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Alphabet</h4>
<add> <hr>
<add> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md
<add>---
<add>id: 587d781a367417b2b2512ab8
<add>title: Use the u Tag to Underline Text
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cN6aQCL'
<add>forumTopicId: 301082
<add>dashedName: use-the-u-tag-to-underline-text
<add>---
<add>
<add># --description--
<add>
<add>To underline text, you can use the `u` tag. This is often used to signify that a section of text is important, or something to remember. With the `u` tag, the browser applies the CSS of `text-decoration: underline;` to the element.
<add>
<add># --instructions--
<add>
<add>Wrap the `u` tag only around the text `Ph.D. students`.
<add>
<add>**Note:** Try to avoid using the `u` tag when it could be confused for a link. Anchor tags also have a default underlined formatting.
<add>
<add># --hints--
<add>
<add>Your code should add a `u` tag to the markup.
<add>
<add>```js
<add>assert($('u').length === 1);
<add>```
<add>
<add>The `u` tag should wrap around the text `Ph.D. students`.
<add>
<add>```js
<add>assert($('u').text() === 'Ph.D. students');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at <strong>Stanford University</strong>.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h4 {
<add> text-align: center;
<add> height: 25px;
<add> }
<add> p {
<add> text-align: justify;
<add> }
<add> .links {
<add> text-align: left;
<add> color: black;
<add> }
<add> .fullCard {
<add> width: 245px;
<add> border: 1px solid #ccc;
<add> border-radius: 5px;
<add> margin: 10px 5px;
<add> padding: 4px;
<add> }
<add> .cardContent {
<add> padding: 10px;
<add> }
<add> .cardText {
<add> margin-bottom: 30px;
<add> }
<add></style>
<add><div class="fullCard">
<add> <div class="cardContent">
<add> <div class="cardText">
<add> <h4>Google</h4>
<add> <p>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</p>
<add> </div>
<add> <div class="cardLinks">
<add> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
<add> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
<add> </div>
<add> </div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md
<add>---
<add>id: bad87fee1348bd9aedf08823
<add>title: Add a Negative Margin to an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cnpyGs3'
<add>forumTopicId: 16166
<add>dashedName: add-a-negative-margin-to-an-element
<add>---
<add>
<add># --description--
<add>
<add>An element's `margin` controls the amount of space between an element's `border` and surrounding elements.
<add>
<add>If you set an element's `margin` to a negative value, the element will grow larger.
<add>
<add># --instructions--
<add>
<add>Try to set the `margin` to a negative value like the one for the red box.
<add>
<add>Change the `margin` of the blue box to `-15px`, so it fills the entire horizontal width of the yellow box around it.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give elements `-15px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-top') === '-15px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> margin: -15px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 20px;
<add> }
<add></style>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> margin: -15px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 20px;
<add> margin-top: -15px;
<add> }
<add></style>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-borders-around-your-elements.md
<add>---
<add>id: bad87fee1348bd9bedf08813
<add>title: Add Borders Around Your Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MvnHZ'
<add>forumTopicId: 16630
<add>dashedName: add-borders-around-your-elements
<add>---
<add>
<add># --description--
<add>
<add>CSS borders have properties like `style`, `color` and `width`.
<add>
<add>For example, if we wanted to create a red, 5 pixel border around an HTML element, we could use this class:
<add>
<add>```html
<add><style>
<add> .thin-red-border {
<add> border-color: red;
<add> border-width: 5px;
<add> border-style: solid;
<add> }
<add></style>
<add>```
<add>
<add># --instructions--
<add>
<add>Create a class called `thick-green-border`. This class should add a 10px, solid, green border around an HTML element. Apply the class to your cat photo.
<add>
<add>Remember that you can apply multiple classes to an element using its `class` attribute, by separating each class name with a space. For example:
<add>
<add>```html
<add><img class="class1 class2">
<add>```
<add>
<add># --hints--
<add>
<add>Your `img` element should have the class `smaller-image`.
<add>
<add>```js
<add>assert($('img').hasClass('smaller-image'));
<add>```
<add>
<add>Your `img` element should have the class `thick-green-border`.
<add>
<add>```js
<add>assert($('img').hasClass('thick-green-border'));
<add>```
<add>
<add>Your image should have a border width of `10px`.
<add>
<add>```js
<add>assert(
<add> $('img').hasClass('thick-green-border') &&
<add> parseInt($('img').css('border-top-width'), 10) >= 8 &&
<add> parseInt($('img').css('border-top-width'), 10) <= 12
<add>);
<add>```
<add>
<add>Your image should have a border style of `solid`.
<add>
<add>```js
<add>assert($('img').css('border-right-style') === 'solid');
<add>```
<add>
<add>The border around your `img` element should be green.
<add>
<add>```js
<add>assert($('img').css('border-left-color') === 'rgb(0, 128, 0)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .thick-green-border {
<add> border-width: 10px;
<add> border-color: green;
<add> border-style: solid;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md
<add>---
<add>id: bad87fee1248bd9aedf08824
<add>title: Add Different Margins to Each Side of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cg4RWh4'
<add>forumTopicId: 16633
<add>dashedName: add-different-margins-to-each-side-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Sometimes you will want to customize an element so that it has a different `margin` on each of its sides.
<add>
<add>CSS allows you to control the `margin` of all four individual sides of an element with the `margin-top`, `margin-right`, `margin-bottom`, and `margin-left` properties.
<add>
<add># --instructions--
<add>
<add>Give the blue box a `margin` of `40px` on its top and left side, but only `20px` on its bottom and right side.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give the top of elements `40px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-top') === '40px');
<add>```
<add>
<add>Your `blue-box` class should give the right of elements `20px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-right') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the bottom of elements `20px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-bottom') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the left of elements `40px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-left') === '40px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> margin-top: 40px;
<add> margin-right: 20px;
<add> margin-bottom: 20px;
<add> margin-left: 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> margin-top: 40px;
<add> margin-right: 20px;
<add> margin-bottom: 20px;
<add> margin-left: 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> margin-top: 40px;
<add> margin-right: 20px;
<add> margin-bottom: 20px;
<add> margin-left: 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.md
<add>---
<add>id: bad87fee1348bd9aedf08824
<add>title: Add Different Padding to Each Side of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cB7mwUw'
<add>forumTopicId: 16634
<add>dashedName: add-different-padding-to-each-side-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Sometimes you will want to customize an element so that it has different amounts of `padding` on each of its sides.
<add>
<add>CSS allows you to control the `padding` of all four individual sides of an element with the `padding-top`, `padding-right`, `padding-bottom`, and `padding-left` properties.
<add>
<add># --instructions--
<add>
<add>Give the blue box a `padding` of `40px` on its top and left side, but only `20px` on its bottom and right side.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give the top of the elements `40px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-top') === '40px');
<add>```
<add>
<add>Your `blue-box` class should give the right of the elements `20px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-right') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the bottom of the elements `20px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-bottom') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the left of the elements `40px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-left') === '40px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding-top: 40px;
<add> padding-right: 20px;
<add> padding-bottom: 20px;
<add> padding-left: 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding-top: 40px;
<add> padding-right: 20px;
<add> padding-bottom: 20px;
<add> padding-left: 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding-top: 40px;
<add> padding-right: 20px;
<add> padding-bottom: 20px;
<add> padding-left: 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.md
<add>---
<add>id: bad87fee1348bd9aedf08814
<add>title: Add Rounded Corners with border-radius
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cbZm2hg'
<add>forumTopicId: 16649
<add>dashedName: add-rounded-corners-with-border-radius
<add>---
<add>
<add># --description--
<add>
<add>Your cat photo currently has sharp corners. We can round out those corners with a CSS property called `border-radius`.
<add>
<add># --instructions--
<add>
<add>You can specify a `border-radius` with pixels. Give your cat photo a `border-radius` of `10px`.
<add>
<add>**Note:** This challenge allows for multiple possible solutions. For example, you may add `border-radius` to either the `.thick-green-border` class or the `.smaller-image` class.
<add>
<add># --hints--
<add>
<add>Your image element should have the class `thick-green-border`.
<add>
<add>```js
<add>assert($('img').hasClass('thick-green-border'));
<add>```
<add>
<add>Your image should have a border radius of `10px`.
<add>
<add>```js
<add>assert(
<add> $('img').css('border-top-left-radius') === '10px' &&
<add> $('img').css('border-top-right-radius') === '10px' &&
<add> $('img').css('border-bottom-left-radius') === '10px' &&
<add> $('img').css('border-bottom-right-radius') === '10px'
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> border-radius: 10px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.md
<add>---
<add>id: bad87fee1348bd9aedf08822
<add>title: Adjust the Margin of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cVJarHW'
<add>forumTopicId: 16654
<add>dashedName: adjust-the-margin-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>An element's `margin` controls the amount of space between an element's `border` and surrounding elements.
<add>
<add>Here, we can see that the blue box and the red box are nested within the yellow box. Note that the red box has a bigger `margin` than the blue box, making it appear smaller.
<add>
<add>When you increase the blue box's `margin`, it will increase the distance between its border and surrounding elements.
<add>
<add># --instructions--
<add>
<add>Change the `margin` of the blue box to match that of the red box.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give elements `20px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-top') === '20px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 20px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 10px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 20px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 20px;
<add> margin: 20px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.md
<add>---
<add>id: bad88fee1348bd9aedf08825
<add>title: Adjust the Padding of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cED8ZC2'
<add>forumTopicId: 301083
<add>dashedName: adjust-the-padding-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Now let's put our Cat Photo App away for a little while and learn more about styling HTML.
<add>
<add>You may have already noticed this, but all HTML elements are essentially little rectangles.
<add>
<add>Three important properties control the space that surrounds each HTML element: `padding`, `border`, and `margin`.
<add>
<add>An element's `padding` controls the amount of space between the element's content and its `border`.
<add>
<add>Here, we can see that the blue box and the red box are nested within the yellow box. Note that the red box has more `padding` than the blue box.
<add>
<add>When you increase the blue box's `padding`, it will increase the distance (`padding`) between the text and the border around it.
<add>
<add># --instructions--
<add>
<add>Change the `padding` of your blue box to match that of your red box.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give elements `20px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-top') === '20px');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 10px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 20px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.md
<add>---
<add>id: 5a9d7286424fe3d0e10cad13
<add>title: Attach a Fallback value to a CSS Variable
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c6bDNfp'
<add>forumTopicId: 301084
<add>dashedName: attach-a-fallback-value-to-a-css-variable
<add>---
<add>
<add># --description--
<add>
<add>When using your variable as a CSS property value, you can attach a fallback value that your browser will revert to if the given variable is invalid.
<add>
<add>**Note:** This fallback is not used to increase browser compatibility, and it will not work on IE browsers. Rather, it is used so that the browser has a color to display if it cannot find your variable.
<add>
<add>Here's how you do it:
<add>
<add>```css
<add>background: var(--penguin-skin, black);
<add>```
<add>
<add>This will set background to `black` if your variable wasn't set. Note that this can be useful for debugging.
<add>
<add># --instructions--
<add>
<add>It looks like there is a problem with the variables supplied to the `.penguin-top` and `.penguin-bottom` classes. Rather than fix the typo, add a fallback value of `black` to the `background` property of the `.penguin-top` and `.penguin-bottom` classes.
<add>
<add># --hints--
<add>
<add>The fallback value of `black` should be used in the `background` property of the `penguin-top` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi
<add> )
<add>);
<add>```
<add>
<add>The fallback value of `black` should be used in `background` property of the `penguin-bottom` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .penguin {
<add> --penguin-skin: black;
<add> --penguin-belly: gray;
<add> --penguin-beak: yellow;
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add>
<add> /* Change code below this line */
<add> background: var(--pengiun-skin);
<add> /* Change code above this line */
<add>
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add>
<add> /* Change code below this line */
<add> background: var(--pengiun-skin);
<add> /* Change code above this line */
<add>
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add> background: var(--penguin-skin, black);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: var(--penguin-skin, black);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: var(--penguin-belly, white);
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: var(--penguin-beak, orange);
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: var(--penguin-beak, orange);
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> body {
<add> background: #c6faf1;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .penguin-top {
<add> background: var(--pengiun-skin, black);
<add> }
<add> .penguin-bottom {
<add> background: var(--pengiun-skin, black);
<add> }
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md
<add>---
<add>id: 5a9d72a1424fe3d0e10cad15
<add>title: Change a variable for a specific area
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cdRwbuW'
<add>forumTopicId: 301085
<add>dashedName: change-a-variable-for-a-specific-area
<add>---
<add>
<add># --description--
<add>
<add>When you create your variables in `:root` they will set the value of that variable for the whole page.
<add>
<add>You can then over-write these variables by setting them again within a specific element.
<add>
<add># --instructions--
<add>
<add>Change the value of `--penguin-belly` to `white` in the `penguin` class.
<add>
<add># --hints--
<add>
<add>The `penguin` class should reassign the `--penguin-belly` variable to `white`.
<add>
<add>```js
<add>assert(
<add> code.match(/\.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add>The `penguin` class should not contain the `background-color` property
<add>
<add>```js
<add>assert(
<add> code.match(/^((?!background-color\s*?:\s*?)[\s\S])*$/g)
<add>);
<add>```
<add>
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> :root {
<add> --penguin-skin: gray;
<add> --penguin-belly: pink;
<add> --penguin-beak: orange;
<add> }
<add>
<add> body {
<add> background: var(--penguin-belly, #c6faf1);
<add> }
<add>
<add> .penguin {
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: var(--penguin-belly, pink);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: var(--penguin-belly, pink);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: var(--penguin-belly, pink);
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add> background: var(--penguin-skin, gray);
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add> background: var(--penguin-skin, gray);
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: var(--penguin-beak, orange);
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: var(--penguin-beak, orange);
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add>.penguin {--penguin-belly: white;}
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/change-the-color-of-text.md
<add>---
<add>id: bad87fee1348bd9aedf08803
<add>title: Change the Color of Text
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cRkVmSm'
<add>forumTopicId: 16775
<add>dashedName: change-the-color-of-text
<add>---
<add>
<add># --description--
<add>
<add>Now let's change the color of some of our text.
<add>
<add>We can do this by changing the `style` of your `h2` element.
<add>
<add>The property that is responsible for the color of an element's text is the `color` style property.
<add>
<add>Here's how you would set your `h2` element's text color to blue:
<add>
<add>```html
<add><h2 style="color: blue;">CatPhotoApp</h2>
<add>```
<add>
<add>Note that it is a good practice to end inline `style` declarations with a `;` .
<add>
<add># --instructions--
<add>
<add>Change your `h2` element's style so that its text color is red.
<add>
<add># --hints--
<add>
<add>Your `h2` element should have a `style` declaration.
<add>
<add>```js
<add>assert($('h2').attr('style'));
<add>```
<add>
<add>Your `h2` element should have color set to `red`.
<add>
<add>```js
<add>assert($('h2')[0].style.color === 'red');
<add>```
<add>
<add>Your `style` declaration should end with a `;` .
<add>
<add>```js
<add>assert($('h2').attr('style') && $('h2').attr('style').endsWith(';'));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><h2 style="color: red;">CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md
<add>---
<add>id: bad87fee1348bd9aedf08806
<add>title: Change the Font Size of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c3bvDc8'
<add>forumTopicId: 16777
<add>dashedName: change-the-font-size-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Font size is controlled by the `font-size` CSS property, like this:
<add>
<add>```css
<add>h1 {
<add> font-size: 30px;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Inside the same `<style>` tag that contains your `red-text` class, create an entry for `p` elements and set the `font-size` to 16 pixels (`16px`).
<add>
<add># --hints--
<add>
<add>Between the `style` tags, give the `p` elements `font-size` of `16px`. Browser and Text zoom should be at 100%.
<add>
<add>```js
<add>assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add> p {
<add> font-size: 16px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/create-a-custom-css-variable.md
<add>---
<add>id: 5a9d726c424fe3d0e10cad11
<add>title: Create a custom CSS Variable
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cQd27Hr'
<add>forumTopicId: 301086
<add>dashedName: create-a-custom-css-variable
<add>---
<add>
<add># --description--
<add>
<add>To create a CSS variable, you just need to give it a name with two hyphens in front of it and assign it a value like this:
<add>
<add>```css
<add>--penguin-skin: gray;
<add>```
<add>
<add>This will create a variable named `--penguin-skin` and assign it the value of `gray`. Now you can use that variable elsewhere in your CSS to change the value of other elements to gray.
<add>
<add># --instructions--
<add>
<add>In the `penguin` class, create a variable name `--penguin-skin` and give it a value of `gray`.
<add>
<add># --hints--
<add>
<add>`penguin` class should declare the `--penguin-skin` variable and assign it to `gray`.
<add>
<add>```js
<add>assert(
<add> code.match(/\.penguin\s*\{[^{}]*?--penguin-skin\s*:\s*gr[ae]y\s*;[^{}]*?\}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .penguin {
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add> background: black;
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add> background: black;
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add> background: black;
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: black;
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: white;
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: white;
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: white;
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: orange;
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: orange;
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: orange;
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: orange;
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> body {
<add> background:#c6faf1;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.penguin {--penguin-skin: gray;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.md
<add>---
<add>id: bad87fed1348bd9aede07836
<add>title: Give a Background Color to a div Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cdRKMCk'
<add>forumTopicId: 18190
<add>dashedName: give-a-background-color-to-a-div-element
<add>---
<add>
<add># --description--
<add>
<add>You can set an element's background color with the `background-color` property.
<add>
<add>For example, if you wanted an element's background color to be `green`, you'd put this within your `style` element:
<add>
<add>```css
<add>.green-background {
<add> background-color: green;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Create a class called `silver-background` with the `background-color` of `silver`. Assign this class to your `div` element.
<add>
<add># --hints--
<add>
<add>Your`div` element should have the class `silver-background`.
<add>
<add>```js
<add>assert($('div').hasClass('silver-background'));
<add>```
<add>
<add>Your `div` element should have a silver background.
<add>
<add>```js
<add>assert($('div').css('background-color') === 'rgb(192, 192, 192)');
<add>```
<add>
<add>A class named `silver-background` should be defined within the `style` element and the value of `silver` should be assigned to the `background-color` property.
<add>
<add>```js
<add>assert(code.match(/\.silver-background\s*{\s*background-color\s*:\s*silver\s*;?\s*}/));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/import-a-google-font.md
<add>---
<add>id: bad87fee1348bd9aedf08807
<add>title: Import a Google Font
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cM9MRsJ'
<add>forumTopicId: 18200
<add>dashedName: import-a-google-font
<add>---
<add>
<add># --description--
<add>
<add>In addition to specifying common fonts that are found on most operating systems, we can also specify non-standard, custom web fonts for use on our website. There are many sources for web fonts on the Internet. For this example we will focus on the Google Fonts library.
<add>
<add>[Google Fonts](https://fonts.google.com/) is a free library of web fonts that you can use in your CSS by referencing the font's URL.
<add>
<add>So, let's go ahead and import and apply a Google font (note that if Google is blocked in your country, you will need to skip this challenge).
<add>
<add>To import a Google Font, you can copy the font's URL from the Google Fonts library and then paste it in your HTML. For this challenge, we'll import the `Lobster` font. To do this, copy the following code snippet and paste it into the top of your code editor (before the opening `style` element):
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add>```
<add>
<add>Now you can use the `Lobster` font in your CSS by using `Lobster` as the FAMILY_NAME as in the following example:
<add>
<add>```css
<add>font-family: FAMILY_NAME, GENERIC_NAME;
<add>```
<add>
<add>The GENERIC_NAME is optional, and is a fallback font in case the other specified font is not available. This is covered in the next challenge.
<add>
<add>Family names are case-sensitive and need to be wrapped in quotes if there is a space in the name. For example, you need quotes to use the `"Open Sans"` font, but not to use the `Lobster` font.
<add>
<add># --instructions--
<add>
<add>Import the `Lobster` font to your web page. Then, use an element selector to set `Lobster` as the `font-family` for your `h2` element.
<add>
<add># --hints--
<add>
<add>You should import the `Lobster` font.
<add>
<add>```js
<add>assert($('link[href*="googleapis" i]').length);
<add>```
<add>
<add>Your `h2` element should use the font `Lobster`.
<add>
<add>```js
<add>assert(
<add> $('h2')
<add> .css('font-family')
<add> .match(/lobster/i)
<add>);
<add>```
<add>
<add>You should only use an `h2` element selector to change the font.
<add>
<add>```js
<add>assert(
<add> /\s*[^\.]h2\s*\{\s*font-family\s*:\s*('|"|)Lobster\1\s*(,\s*('|"|)[a-z -]+\3\s*)?(;\s*\}|\})/gi.test(
<add> code
<add> )
<add>);
<add>```
<add>
<add>Your `p` element should still use the font `monospace`.
<add>
<add>```js
<add>assert(
<add> $('p')
<add> .css('font-family')
<add> .match(/monospace/i)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/improve-compatibility-with-browser-fallbacks.md
<add>---
<add>id: 5b7d72c338cd7e35b63f3e14
<add>title: Improve Compatibility with Browser Fallbacks
<add>challengeType: 0
<add>videoUrl: ''
<add>forumTopicId: 301087
<add>dashedName: improve-compatibility-with-browser-fallbacks
<add>---
<add>
<add># --description--
<add>
<add>When working with CSS you will likely run into browser compatibility issues at some point. This is why it's important to provide browser fallbacks to avoid potential problems.
<add>
<add>When your browser parses the CSS of a webpage, it ignores any properties that it doesn't recognize or support. For example, if you use a CSS variable to assign a background color on a site, Internet Explorer will ignore the background color because it does not support CSS variables. In that case, the browser will use whatever value it has for that property. If it can't find any other value set for that property, it will revert to the default value, which is typically not ideal.
<add>
<add>This means that if you do want to provide a browser fallback, it's as easy as providing another more widely supported value immediately before your declaration. That way an older browser will have something to fall back on, while a newer browser will just interpret whatever declaration comes later in the cascade.
<add>
<add># --instructions--
<add>
<add>It looks like a variable is being used to set the background color of the `.red-box` class. Let's improve our browser compatibility by adding another `background` declaration right before the existing declaration and set its value to `red`.
<add>
<add># --hints--
<add>
<add>Your `.red-box` rule should include a fallback with the `background` set to `red` immediately before the existing `background` declaration.
<add>
<add>```js
<add>assert(
<add> code
<add> .replace(/\s/g, '')
<add> .match(
<add> /\.red-box{background:(red|#ff0000|#f00|rgb\(255,0,0\)|rgb\(100%,0%,0%\)|hsl\(0,100%,50%\));background:var\(--red-color\);height:200px;width:200px;}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> :root {
<add> --red-color: red;
<add> }
<add> .red-box {
<add>
<add> background: var(--red-color);
<add> height: 200px;
<add> width:200px;
<add> }
<add></style>
<add><div class="red-box"></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> :root {
<add> --red-color: red;
<add> }
<add> .red-box {
<add> background: red;
<add> background: var(--red-color);
<add> height: 200px;
<add> width:200px;
<add> }
<add></style>
<add><div class="red-box"></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/inherit-css-variables.md
<add>---
<add>id: 5a9d7295424fe3d0e10cad14
<add>title: Inherit CSS Variables
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cyLZZhZ'
<add>forumTopicId: 301088
<add>dashedName: inherit-css-variables
<add>---
<add>
<add># --description--
<add>
<add>When you create a variable, it is available for you to use inside the selector in which you create it. It also is available in any of that selector's descendants. This happens because CSS variables are inherited, just like ordinary properties.
<add>
<add>To make use of inheritance, CSS variables are often defined in the <dfn>:root</dfn> element.
<add>
<add>`:root` is a <dfn>pseudo-class</dfn> selector that matches the root element of the document, usually the `html` element. By creating your variables in `:root`, they will be available globally and can be accessed from any other selector in the style sheet.
<add>
<add># --instructions--
<add>
<add>Define a variable named `--penguin-belly` in the `:root` selector and give it the value of `pink`. You can then see that the variable is inherited and that all the child elements which use it get pink backgrounds.
<add>
<add># --hints--
<add>
<add>The `--penguin-belly` variable should be declared in the `:root` and assigned the value `pink`.
<add>
<add>```js
<add>assert(
<add> code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> :root {
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> body {
<add> background: var(--penguin-belly, #c6faf1);
<add> }
<add>
<add> .penguin {
<add> --penguin-skin: gray;
<add> --penguin-beak: orange;
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: var(--penguin-belly, white);
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add> background: var(--penguin-skin, gray);
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add> background: var(--penguin-skin, gray);
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: var(--penguin-beak, orange);
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: var(--penguin-beak, orange);
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>:root {--penguin-belly: pink;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.md
<add>---
<add>id: bad87fee1348bd9aedf08746
<add>title: Inherit Styles from the Body Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c9bmdtR'
<add>forumTopicId: 18204
<add>dashedName: inherit-styles-from-the-body-element
<add>---
<add>
<add># --description--
<add>
<add>Now we've proven that every HTML page has a `body` element, and that its `body` element can also be styled with CSS.
<add>
<add>Remember, you can style your `body` element just like any other HTML element, and all your other elements will inherit your `body` element's styles.
<add>
<add># --instructions--
<add>
<add>First, create a `h1` element with the text `Hello World`
<add>
<add>Then, let's give all elements on your page the color of `green` by adding `color: green;` to your `body` element's style declaration.
<add>
<add>Finally, give your `body` element the font-family of `monospace` by adding `font-family: monospace;` to your `body` element's style declaration.
<add>
<add># --hints--
<add>
<add>You should create an `h1` element.
<add>
<add>```js
<add>assert($('h1').length > 0);
<add>```
<add>
<add>Your `h1` element should have the text `Hello World`.
<add>
<add>```js
<add>assert(
<add> $('h1').length > 0 &&
<add> $('h1')
<add> .text()
<add> .match(/hello world/i)
<add>);
<add>```
<add>
<add>Your `h1` element should have a closing tag.
<add>
<add>```js
<add>assert(
<add> code.match(/<\/h1>/g) &&
<add> code.match(/<h1/g) &&
<add> code.match(/<\/h1>/g).length === code.match(/<h1/g).length
<add>);
<add>```
<add>
<add>Your `body` element should have the `color` property of `green`.
<add>
<add>```js
<add>assert($('body').css('color') === 'rgb(0, 128, 0)');
<add>```
<add>
<add>Your `body` element should have the `font-family` property of `monospace`.
<add>
<add>```js
<add>assert(
<add> $('body')
<add> .css('font-family')
<add> .match(/monospace/i)
<add>);
<add>```
<add>
<add>Your `h1` element should inherit the font `monospace` from your `body` element.
<add>
<add>```js
<add>assert(
<add> $('h1').length > 0 &&
<add> $('h1')
<add> .css('font-family')
<add> .match(/monospace/i)
<add>);
<add>```
<add>
<add>Your `h1` element should inherit the color green from your `body` element.
<add>
<add>```js
<add>assert($('h1').length > 0 && $('h1').css('color') === 'rgb(0, 128, 0)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> }
<add>
<add></style>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add>
<add></style>
<add><h1>Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.md
<add>---
<add>id: bad87fee1348bd9aedf08815
<add>title: Make Circular Images with a border-radius
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MvrcB'
<add>forumTopicId: 18229
<add>dashedName: make-circular-images-with-a-border-radius
<add>---
<add>
<add># --description--
<add>
<add>In addition to pixels, you can also specify the `border-radius` using a percentage.
<add>
<add># --instructions--
<add>
<add>Give your cat photo a `border-radius` of `50%`.
<add>
<add># --hints--
<add>
<add>Your image should have a border radius of `50%`, making it perfectly circular.
<add>
<add>```js
<add>assert(parseInt($('img').css('border-top-left-radius')) > 48);
<add>```
<add>
<add>The `border-radius` value should use a percentage value of `50%`.
<add>
<add>```js
<add>assert(code.match(/50%/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 10px;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 10px;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> border-radius: 50%;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.md
<add>---
<add>id: bad87fee1348bd9aedf07756
<add>title: Override All Other Styles by using Important
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cm24rcp'
<add>forumTopicId: 18249
<add>dashedName: override-all-other-styles-by-using-important
<add>---
<add>
<add># --description--
<add>
<add>Yay! We just proved that inline styles will override all the CSS declarations in your `style` element.
<add>
<add>But wait. There's one last way to override CSS. This is the most powerful method of all. But before we do it, let's talk about why you would ever want to override CSS.
<add>
<add>In many situations, you will use CSS libraries. These may accidentally override your own CSS. So when you absolutely need to be sure that an element has specific CSS, you can use `!important`.
<add>
<add>Let's go all the way back to our `pink-text` class declaration. Remember that our `pink-text` class was overridden by subsequent class declarations, id declarations, and inline styles.
<add>
<add># --instructions--
<add>
<add>Let's add the keyword `!important` to your pink-text element's color declaration to make 100% sure that your `h1` element will be pink.
<add>
<add>An example of how to do this is:
<add>
<add>```css
<add>color: red !important;
<add>```
<add>
<add># --hints--
<add>
<add>Your `h1` element should have the class `pink-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('pink-text'));
<add>```
<add>
<add>Your `h1` element should have the class `blue-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('blue-text'));
<add>```
<add>
<add>Your `h1` element should have the `id` of `orange-text`.
<add>
<add>```js
<add>assert($('h1').attr('id') === 'orange-text');
<add>```
<add>
<add>Your `h1` element should have the inline style of `color: white`.
<add>
<add>```js
<add>assert(code.match(/<h1.*style/gi) && code.match(/<h1.*style.*color\s*?:/gi));
<add>```
<add>
<add>Your `pink-text` class declaration should have the `!important` keyword to override all other declarations.
<add>
<add>```js
<add>assert(
<add> code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g)
<add>);
<add>```
<add>
<add>Your `h1` element should be pink.
<add>
<add>```js
<add>assert($('h1').css('color') === 'rgb(255, 192, 203)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> #orange-text {
<add> color: orange;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> #orange-text {
<add> color: orange;
<add> }
<add> .pink-text {
<add> color: pink !important;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.md
<add>---
<add>id: bad87fee1348bd8aedf06756
<add>title: Override Class Declarations by Styling ID Attributes
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cRkpDhB'
<add>forumTopicId: 18251
<add>dashedName: override-class-declarations-by-styling-id-attributes
<add>---
<add>
<add># --description--
<add>
<add>We just proved that browsers read CSS from top to bottom in order of their declaration. That means that, in the event of a conflict, the browser will use whichever CSS declaration came last. Notice that if we even had put `blue-text` before `pink-text` in our `h1` element's classes, it would still look at the declaration order and not the order of their use!
<add>
<add>But we're not done yet. There are other ways that you can override CSS. Do you remember id attributes?
<add>
<add>Let's override your `pink-text` and `blue-text` classes, and make your `h1` element orange, by giving the `h1` element an id and then styling that id.
<add>
<add># --instructions--
<add>
<add>Give your `h1` element the `id` attribute of `orange-text`. Remember, id styles look like this:
<add>
<add>```html
<add><h1 id="orange-text">
<add>```
<add>
<add>Leave the `blue-text` and `pink-text` classes on your `h1` element.
<add>
<add>Create a CSS declaration for your `orange-text` id in your `style` element. Here's an example of what this looks like:
<add>
<add>```css
<add>#brown-text {
<add> color: brown;
<add>}
<add>```
<add>
<add>**Note:** It doesn't matter whether you declare this CSS above or below `pink-text` class, since the `id` attribute will always take precedence.
<add>
<add># --hints--
<add>
<add>Your `h1` element should have the class `pink-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('pink-text'));
<add>```
<add>
<add>Your `h1` element should have the class `blue-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('blue-text'));
<add>```
<add>
<add>Your `h1` element should have the id of `orange-text`.
<add>
<add>```js
<add>assert($('h1').attr('id') === 'orange-text');
<add>```
<add>
<add>There should be only one `h1` element.
<add>
<add>```js
<add>assert($('h1').length === 1);
<add>```
<add>
<add>Your `orange-text` id should have a CSS declaration.
<add>
<add>```js
<add>assert(code.match(/#orange-text\s*{/gi));
<add>```
<add>
<add>Your `h1` should not have any `style` attributes.
<add>
<add>```js
<add>assert(!code.match(/<h1.*style.*>/gi));
<add>```
<add>
<add>Your `h1` element should be orange.
<add>
<add>```js
<add>assert($('h1').css('color') === 'rgb(255, 165, 0)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 class="pink-text blue-text">Hello World!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add> #orange-text {
<add> color: orange;
<add> }
<add></style>
<add><h1 id="orange-text" class="pink-text blue-text">Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.md
<add>---
<add>id: bad87fee1348bd9aedf06756
<add>title: Override Class Declarations with Inline Styles
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cGJDRha'
<add>forumTopicId: 18252
<add>dashedName: override-class-declarations-with-inline-styles
<add>---
<add>
<add># --description--
<add>
<add>So we've proven that id declarations override class declarations, regardless of where they are declared in your `style` element CSS.
<add>
<add>There are other ways that you can override CSS. Do you remember inline styles?
<add>
<add># --instructions--
<add>
<add>Use an inline style to try to make our `h1` element white. Remember, inline styles look like this:
<add>
<add>```html
<add><h1 style="color: green;">
<add>```
<add>
<add>Leave the `blue-text` and `pink-text` classes on your `h1` element.
<add>
<add># --hints--
<add>
<add>Your `h1` element should have the class `pink-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('pink-text'));
<add>```
<add>
<add>Your `h1` element should have the class `blue-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('blue-text'));
<add>```
<add>
<add>Your `h1` element should have the id of `orange-text`.
<add>
<add>```js
<add>assert($('h1').attr('id') === 'orange-text');
<add>```
<add>
<add>Your `h1` element should have an inline style.
<add>
<add>```js
<add>assert(document.querySelector('h1[style]'));
<add>```
<add>
<add>Your `h1` element should be white.
<add>
<add>```js
<add>assert($('h1').css('color') === 'rgb(255, 255, 255)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> #orange-text {
<add> color: orange;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 id="orange-text" class="pink-text blue-text">Hello World!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> #orange-text {
<add> color: orange;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.md
<add>---
<add>id: bad87fee1348bd9aedf04756
<add>title: Override Styles in Subsequent CSS
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cGJDQug'
<add>forumTopicId: 18253
<add>dashedName: override-styles-in-subsequent-css
<add>---
<add>
<add># --description--
<add>
<add>Our `pink-text` class overrode our `body` element's CSS declaration!
<add>
<add>We just proved that our classes will override the `body` element's CSS. So the next logical question is, what can we do to override our `pink-text` class?
<add>
<add># --instructions--
<add>
<add>Create an additional CSS class called `blue-text` that gives an element the color blue. Make sure it's below your `pink-text` class declaration.
<add>
<add>Apply the `blue-text` class to your `h1` element in addition to your `pink-text` class, and let's see which one wins.
<add>
<add>Applying multiple class attributes to a HTML element is done with a space between them like this:
<add>
<add>```html
<add>class="class1 class2"
<add>```
<add>
<add>**Note:** It doesn't matter which order the classes are listed in the HTML element.
<add>
<add>However, the order of the `class` declarations in the `<style>` section is what is important. The second declaration will always take precedence over the first. Because `.blue-text` is declared second, it overrides the attributes of `.pink-text`
<add>
<add># --hints--
<add>
<add>Your `h1` element should have the class `pink-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('pink-text'));
<add>```
<add>
<add>Your `h1` element should have the class `blue-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('blue-text'));
<add>```
<add>
<add>Both `blue-text` and `pink-text` should belong to the same `h1` element.
<add>
<add>```js
<add>assert($('.pink-text').hasClass('blue-text'));
<add>```
<add>
<add>Your `h1` element should be blue.
<add>
<add>```js
<add>assert($('h1').css('color') === 'rgb(0, 0, 255)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add></style>
<add><h1 class="pink-text">Hello World!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add>
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add><h1 class="pink-text blue-text">Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.md
<add>---
<add>id: bad87fee1348bd9aedf08756
<add>title: Prioritize One Style Over Another
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cZ8wnHv'
<add>forumTopicId: 18258
<add>dashedName: prioritize-one-style-over-another
<add>---
<add>
<add># --description--
<add>
<add>Sometimes your HTML elements will receive multiple styles that conflict with one another.
<add>
<add>For example, your `h1` element can't be both green and pink at the same time.
<add>
<add>Let's see what happens when we create a class that makes text pink, then apply it to an element. Will our class *override* the `body` element's `color: green;` CSS property?
<add>
<add># --instructions--
<add>
<add>Create a CSS class called `pink-text` that gives an element the color pink.
<add>
<add>Give your `h1` element the class of `pink-text`.
<add>
<add># --hints--
<add>
<add>Your `h1` element should have the class `pink-text`.
<add>
<add>```js
<add>assert($('h1').hasClass('pink-text'));
<add>```
<add>
<add>Your `<style>` should have a `pink-text` CSS class that changes the `color`.
<add>
<add>```js
<add>assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;?\s*\}/g));
<add>```
<add>
<add>Your `h1` element should be pink.
<add>
<add>```js
<add>assert($('h1').css('color') === 'rgb(255, 192, 203)');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add></style>
<add><h1>Hello World!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> font-family: monospace;
<add> color: green;
<add> }
<add> .pink-text {
<add> color: pink;
<add> }
<add></style>
<add><h1 class="pink-text">Hello World!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.md
<add>---
<add>id: bad87fee1348bd9aede08807
<add>title: Set the Font Family of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c3bvpCg'
<add>forumTopicId: 18278
<add>dashedName: set-the-font-family-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>You can set which font an element should use, by using the `font-family` property.
<add>
<add>For example, if you wanted to set your `h2` element's font to `sans-serif`, you would use the following CSS:
<add>
<add>```css
<add>h2 {
<add> font-family: sans-serif;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Make all of your `p` elements use the `monospace` font.
<add>
<add># --hints--
<add>
<add>Your `p` elements should use the font `monospace`.
<add>
<add>```js
<add>assert(
<add> $('p')
<add> .not('.red-text')
<add> .css('font-family')
<add> .match(/monospace/i)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/set-the-id-of-an-element.md
<add>---
<add>id: bad87eee1348bd9aede07836
<add>title: Set the id of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cN6MEc2'
<add>forumTopicId: 18279
<add>dashedName: set-the-id-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>In addition to classes, each HTML element can also have an `id` attribute.
<add>
<add>There are several benefits to using `id` attributes: You can use an `id` to style a single element and later you'll learn that you can use them to select and modify specific elements with JavaScript.
<add>
<add>`id` attributes should be unique. Browsers won't enforce this, but it is a widely agreed upon best practice. So please don't give more than one element the same `id` attribute.
<add>
<add>Here's an example of how you give your `h2` element the id of `cat-photo-app`:
<add>
<add>```html
<add><h2 id="cat-photo-app">
<add>```
<add>
<add># --instructions--
<add>
<add>Give your `form` element the id `cat-photo-form`.
<add>
<add># --hints--
<add>
<add>Your `form` element should have the id of `cat-photo-form`.
<add>
<add>```js
<add>assert($('form').attr('id') === 'cat-photo-form');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/size-your-images.md
<add>---
<add>id: bad87fee1348bd9acdf08812
<add>title: Size Your Images
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cM9MmCP'
<add>forumTopicId: 18282
<add>dashedName: size-your-images
<add>---
<add>
<add># --description--
<add>
<add>CSS has a property called `width` that controls an element's width. Just like with fonts, we'll use `px` (pixels) to specify the image's width.
<add>
<add>For example, if we wanted to create a CSS class called `larger-image` that gave HTML elements a width of 500 pixels, we'd use:
<add>
<add>```html
<add><style>
<add> .larger-image {
<add> width: 500px;
<add> }
<add></style>
<add>```
<add>
<add># --instructions--
<add>
<add>Create a class called `smaller-image` and use it to resize the image so that it's only 100 pixels wide.
<add>
<add># --hints--
<add>
<add>Your `img` element should have the class `smaller-image`.
<add>
<add>```js
<add>assert(
<add> $("img[src='https://bit.ly/fcc-relaxing-cat']").attr('class')
<add> .trim().split(/\s+/g).includes('smaller-image')
<add>);
<add>```
<add>
<add>Your image should be 100 pixels wide.
<add>
<add>```js
<add>assert(
<add> $('img').width() < 200 &&
<add> code.match(/\.smaller-image\s*{\s*width\s*:\s*100px\s*(;\s*}|})/i)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.md
<add>---
<add>id: bad87fee1348bd9aedf08808
<add>title: Specify How Fonts Should Degrade
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cpVKBfQ'
<add>forumTopicId: 18304
<add>dashedName: specify-how-fonts-should-degrade
<add>---
<add>
<add># --description--
<add>
<add>There are several default fonts that are available in all browsers. These generic font families include `monospace`, `serif` and `sans-serif`.
<add>
<add>When one font isn't available, you can tell the browser to "degrade" to another font.
<add>
<add>For example, if you wanted an element to use the `Helvetica` font, but degrade to the `sans-serif` font when `Helvetica` isn't available, you will specify it as follows:
<add>
<add>```css
<add>p {
<add> font-family: Helvetica, sans-serif;
<add>}
<add>```
<add>
<add>Generic font family names are not case-sensitive. Also, they do not need quotes because they are CSS keywords.
<add>
<add># --instructions--
<add>
<add>To begin, apply the `monospace` font to the `h2` element, so that it now has two fonts - `Lobster` and `monospace`.
<add>
<add>In the last challenge, you imported the `Lobster` font using the `link` tag. Now comment out that import of the `Lobster` font (using the HTML comments you learned before) from Google Fonts so that it isn't available anymore. Notice how your `h2` element degrades to the `monospace` font.
<add>
<add>**Note:** If you have the `Lobster` font installed on your computer, you won't see the degradation because your browser is able to find the font.
<add>
<add># --hints--
<add>
<add>Your h2 element should use the font `Lobster`.
<add>
<add>```js
<add>assert(
<add> $('h2')
<add> .css('font-family')
<add> .match(/^"?lobster/i)
<add>);
<add>```
<add>
<add>Your h2 element should degrade to the font `monospace` when `Lobster` is not available.
<add>
<add>```js
<add>assert(
<add> /\s*h2\s*\{\s*font-family\s*\:\s*(\'|"|)Lobster\1\s*,\s*monospace\s*;?\s*\}/gi.test(
<add> code
<add> )
<add>);
<add>```
<add>
<add>You should comment out your call to Google for the `Lobster` font by putting `<!--` in front of it.
<add>
<add>```js
<add>assert(new RegExp('<!--[^fc]', 'gi').test(code));
<add>```
<add>
<add>You should close your comment by adding `-->`.
<add>
<add>```js
<add>assert(new RegExp('[^fc]-->', 'gi').test(code));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><!--<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">-->
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.md
<add>---
<add>id: bad87fee1348bd9aefe08806
<add>title: Style Multiple Elements with a CSS Class
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cRkVbsQ'
<add>forumTopicId: 18311
<add>dashedName: style-multiple-elements-with-a-css-class
<add>---
<add>
<add># --description--
<add>
<add>Classes allow you to use the same CSS styles on multiple HTML elements. You can see this by applying your `red-text` class to the first `p` element.
<add>
<add># --hints--
<add>
<add>Your `h2` element should be red.
<add>
<add>```js
<add>assert($('h2').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>Your `h2` element should have the class `red-text`.
<add>
<add>```js
<add>assert($('h2').hasClass('red-text'));
<add>```
<add>
<add>Your first `p` element should be red.
<add>
<add>```js
<add>assert($('p:eq(0)').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>Your second and third `p` elements should not be red.
<add>
<add>```js
<add>assert(
<add> !($('p:eq(1)').css('color') === 'rgb(255, 0, 0)') &&
<add> !($('p:eq(2)').css('color') === 'rgb(255, 0, 0)')
<add>);
<add>```
<add>
<add>Your first `p` element should have the class `red-text`.
<add>
<add>```js
<add>assert($('p:eq(0)').hasClass('red-text'));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/style-the-html-body-element.md
<add>---
<add>id: bad87fee1348bd9aedf08736
<add>title: Style the HTML Body Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cB77PHW'
<add>forumTopicId: 18313
<add>dashedName: style-the-html-body-element
<add>---
<add>
<add># --description--
<add>
<add>Now let's start fresh and talk about CSS inheritance.
<add>
<add>Every HTML page has a `body` element.
<add>
<add># --instructions--
<add>
<add>We can prove that the `body` element exists here by giving it a `background-color` of black.
<add>
<add>We can do this by adding the following to our `style` element:
<add>
<add>```css
<add>body {
<add> background-color: black;
<add>}
<add>```
<add>
<add># --hints--
<add>
<add>Your `body` element should have the `background-color` of black.
<add>
<add>```js
<add>assert($('body').css('background-color') === 'rgb(0, 0, 0)');
<add>```
<add>
<add>Your CSS rule should be properly formatted with both opening and closing curly brackets.
<add>
<add>```js
<add>assert(
<add> code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i)
<add>);
<add>```
<add>
<add>Your CSS rule should end with a semi-colon.
<add>
<add>```js
<add>assert(
<add> code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add>
<add></style>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add>body {
<add> background-color: black;
<add>}
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.md
<add>---
<add>id: bad82fee1322bd9aedf08721
<add>title: Understand Absolute versus Relative Units
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cN66JSL'
<add>forumTopicId: 301089
<add>dashedName: understand-absolute-versus-relative-units
<add>---
<add>
<add># --description--
<add>
<add>The last several challenges all set an element's margin or padding with pixels (`px`). Pixels are a type of length unit, which is what tells the browser how to size or space an item. In addition to `px`, CSS has a number of different length unit options that you can use.
<add>
<add>The two main types of length units are absolute and relative. Absolute units tie to physical units of length. For example, `in` and `mm` refer to inches and millimeters, respectively. Absolute length units approximate the actual measurement on a screen, but there are some differences depending on a screen's resolution.
<add>
<add>Relative units, such as `em` or `rem`, are relative to another length value. For example, `em` is based on the size of an element's font. If you use it to set the `font-size` property itself, it's relative to the parent's `font-size`.
<add>
<add>**Note:** There are several relative unit options that are tied to the size of the viewport. They are covered in the Responsive Web Design Principles section.
<add>
<add># --instructions--
<add>
<add>Add a `padding` property to the element with class `red-box` and set it to `1.5em`.
<add>
<add># --hints--
<add>
<add>Your `red-box` class should have a `padding` property.
<add>
<add>```js
<add>assert(
<add> $('.red-box').css('padding-top') != '0px' &&
<add> $('.red-box').css('padding-right') != '0px' &&
<add> $('.red-box').css('padding-bottom') != '0px' &&
<add> $('.red-box').css('padding-left') != '0px'
<add>);
<add>```
<add>
<add>Your `red-box` class should give elements 1.5em of `padding`.
<add>
<add>```js
<add>assert(code.match(/\.red-box\s*?{[\s\S]*padding\s*:\s*?1\.5em/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: red;
<add> margin: 20px 40px 20px 40px;
<add>
<add> }
<add>
<add> .green-box {
<add> background-color: green;
<add> margin: 20px 40px 20px 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box green-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: red;
<add> margin: 20px 40px 20px 40px;
<add> padding: 1.5em;
<add> }
<add>
<add> .green-box {
<add> background-color: green;
<add> margin: 20px 40px 20px 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box green-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.md
<add>---
<add>id: bad87fee1348bd9aecf08806
<add>title: Use a CSS Class to Style an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c2MvDtV'
<add>forumTopicId: 18337
<add>dashedName: use-a-css-class-to-style-an-element
<add>---
<add>
<add># --description--
<add>
<add>Classes are reusable styles that can be added to HTML elements.
<add>
<add>Here's an example CSS class declaration:
<add>
<add>```html
<add><style>
<add> .blue-text {
<add> color: blue;
<add> }
<add></style>
<add>```
<add>
<add>You can see that we've created a CSS class called `blue-text` within the `<style>` tag. You can apply a class to an HTML element like this: `<h2 class="blue-text">CatPhotoApp</h2>`. Note that in your CSS `style` element, class names start with a period. In your HTML elements' class attribute, the class name does not include the period.
<add>
<add># --instructions--
<add>
<add>Inside your `style` element, change the `h2` selector to `.red-text` and update the color's value from `blue` to `red`.
<add>
<add>Give your `h2` element the `class` attribute with a value of `red-text`.
<add>
<add># --hints--
<add>
<add>Your `h2` element should be red.
<add>
<add>```js
<add>assert($('h2').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>Your `h2` element should have the class `red-text`.
<add>
<add>```js
<add>assert($('h2').hasClass('red-text'));
<add>```
<add>
<add>Your stylesheet should declare a `red-text` class and have its color set to `red`.
<add>
<add>```js
<add>assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;?\s*\}/g));
<add>```
<add>
<add>You should not use inline style declarations like `style="color: red"` in your `h2` element.
<add>
<add>```js
<add>assert($('h2').attr('style') === undefined);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> h2 {
<add> color: blue;
<add> }
<add></style>
<add>
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-a-custom-css-variable.md
<add>---
<add>id: 5a9d727a424fe3d0e10cad12
<add>title: Use a custom CSS Variable
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cM989ck'
<add>forumTopicId: 301090
<add>dashedName: use-a-custom-css-variable
<add>---
<add>
<add># --description--
<add>
<add>After you create your variable, you can assign its value to other CSS properties by referencing the name you gave it.
<add>
<add>```css
<add>background: var(--penguin-skin);
<add>```
<add>
<add>This will change the background of whatever element you are targeting to gray because that is the value of the `--penguin-skin` variable. Note that styles will not be applied unless the variable names are an exact match.
<add>
<add># --instructions--
<add>
<add>Apply the `--penguin-skin` variable to the `background` property of the `penguin-top`, `penguin-bottom`, `right-hand` and `left-hand` classes.
<add>
<add># --hints--
<add>
<add>The `--penguin-skin` variable should be applied to the `background` property of the `penguin-top` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi
<add> )
<add>);
<add>```
<add>
<add>The `--penguin-skin` variable should be applied to the `background` property of the `penguin-bottom` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi
<add> )
<add>);
<add>```
<add>
<add>The `--penguin-skin` variable should be applied to the `background` property of the `right-hand` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi
<add> )
<add>);
<add>```
<add>
<add>The `--penguin-skin` variable should be applied to the `background` property of the `left-hand` class.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .penguin {
<add> --penguin-skin: gray;
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add>
<add> /* Change code below this line */
<add> background: black;
<add> /* Change code above this line */
<add>
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add>
<add> /* Change code below this line */
<add> background: black;
<add> /* Change code above this line */
<add>
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add>
<add> /* Change code below this line */
<add> background: black;
<add> /* Change code above this line */
<add>
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add>
<add> /* Change code below this line */
<add> background: black;
<add> /* Change code above this line */
<add>
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: white;
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: white;
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: white;
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: orange;
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: orange;
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: orange;
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: orange;
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> body {
<add> background:#c6faf1;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.penguin-top {background: var(--penguin-skin);} .penguin-bottom {background: var(--penguin-skin);} .right-hand {background: var(--penguin-skin);} .left-hand {background: var(--penguin-skin);}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.md
<add>---
<add>id: 5a9d72ad424fe3d0e10cad16
<add>title: Use a media query to change a variable
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cWmL8UP'
<add>forumTopicId: 301091
<add>dashedName: use-a-media-query-to-change-a-variable
<add>---
<add>
<add># --description--
<add>
<add>CSS Variables can simplify the way you use media queries.
<add>
<add>For instance, when your screen is smaller or larger than your media query break point, you can change the value of a variable, and it will apply its style wherever it is used.
<add>
<add># --instructions--
<add>
<add>In the `:root` selector of the `media query`, change it so `--penguin-size` is redefined and given a value of `200px`. Also, redefine `--penguin-skin` and give it a value of `black`. Then resize the preview to see this change in action.
<add>
<add># --hints--
<add>
<add>`:root` should reassign the `--penguin-size` variable to `200px`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add>`:root` should reassign the `--penguin-skin` variable to `black`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> :root {
<add> --penguin-size: 300px;
<add> --penguin-skin: gray;
<add> --penguin-belly: white;
<add> --penguin-beak: orange;
<add> }
<add>
<add> @media (max-width: 350px) {
<add> :root {
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> }
<add> }
<add>
<add> .penguin {
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: var(--penguin-size, 300px);
<add> height: var(--penguin-size, 300px);
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: var(--penguin-belly, white);
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add> background: var(--penguin-skin, gray);
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add> background: var(--penguin-skin, gray);
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 5%;
<add> left: 25%;
<add> background: var(--penguin-skin, black);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(130deg);
<add> z-index: -1;
<add> animation-duration: 3s;
<add> animation-name: wave;
<add> animation-iteration-count: infinite;
<add> transform-origin:0% 0%;
<add> animation-timing-function: linear;
<add> }
<add>
<add> @keyframes wave {
<add> 10% {
<add> transform: rotate(110deg);
<add> }
<add> 20% {
<add> transform: rotate(130deg);
<add> }
<add> 30% {
<add> transform: rotate(110deg);
<add> }
<add> 40% {
<add> transform: rotate(130deg);
<add> }
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left:-23%;
<add> background: white;
<add> width: 150%;
<add> height: 100%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: var(--penguin-beak, orange);
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: var(--penguin-beak, orange);
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> body {
<add> background:#c6faf1;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>@media (max-width: 350px) {:root {--penguin-size: 200px; --penguin-skin: black;}}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-abbreviated-hex-code.md
<add>---
<add>id: bad87fee1348bd9aedf08719
<add>title: Use Abbreviated Hex Code
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cRkpKAm'
<add>forumTopicId: 18338
<add>dashedName: use-abbreviated-hex-code
<add>---
<add>
<add># --description--
<add>
<add>Many people feel overwhelmed by the possibilities of more than 16 million colors. And it's difficult to remember hex code. Fortunately, you can shorten it.
<add>
<add>For example, red's hex code `#FF0000` can be shortened to `#F00`. This shortened form gives one digit for red, one digit for green, and one digit for blue.
<add>
<add>This reduces the total number of possible colors to around 4,000. But browsers will interpret `#FF0000` and `#F00` as exactly the same color.
<add>
<add># --instructions--
<add>
<add>Go ahead, try using the abbreviated hex codes to color the correct elements.
<add>
<add><table class='table table-striped'><tbody><tr><th>Color</th><th>Short Hex Code</th></tr><tr><td>Cyan</td><td><code>#0FF</code></td></tr><tr><td>Green</td><td><code>#0F0</code></td></tr><tr><td>Red</td><td><code>#F00</code></td></tr><tr><td>Fuchsia</td><td><code>#F0F</code></td></tr></tbody></table>
<add>
<add># --hints--
<add>
<add>Your `h1` element with the text `I am red!` should be given the `color` red.
<add>
<add>```js
<add>assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>The abbreviated `hex code` for the color red should be used instead of the hex code `#FF0000`.
<add>
<add>```js
<add>assert(code.match(/\.red-text\s*?{\s*?color\s*:\s*?#F00\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am green!` should be given the `color` green.
<add>
<add>```js
<add>assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
<add>```
<add>
<add>The abbreviated `hex code` for the color green should be used instead of the hex code `#00FF00`.
<add>
<add>```js
<add>assert(code.match(/\.green-text\s*?{\s*?color\s*:\s*?#0F0\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am cyan!` should be given the `color` cyan.
<add>
<add>```js
<add>assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)');
<add>```
<add>
<add>The abbreviated `hex code` for the color cyan should be used instead of the hex code `#00FFFF`.
<add>
<add>```js
<add>assert(code.match(/\.cyan-text\s*?{\s*?color\s*:\s*?#0FF\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am fuchsia!` should be given the `color` fuchsia.
<add>
<add>```js
<add>assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)');
<add>```
<add>
<add>The abbreviated `hex code` for the color fuchsia should be used instead of the hex code `#FF00FF`.
<add>
<add>```js
<add>assert(code.match(/\.fuchsia-text\s*?{\s*?color\s*:\s*?#F0F\s*?;?\s*?}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: #000000;
<add> }
<add> .fuchsia-text {
<add> color: #000000;
<add> }
<add> .cyan-text {
<add> color: #000000;
<add> }
<add> .green-text {
<add> color: #000000;
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="fuchsia-text">I am fuchsia!</h1>
<add>
<add><h1 class="cyan-text">I am cyan!</h1>
<add>
<add><h1 class="green-text">I am green!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: #F00;
<add> }
<add> .fuchsia-text {
<add> color: #F0F;
<add> }
<add> .cyan-text {
<add> color: #0FF;
<add> }
<add> .green-text {
<add> color: #0F0;
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="fuchsia-text">I am fuchsia!</h1>
<add>
<add><h1 class="cyan-text">I am cyan!</h1>
<add>
<add><h1 class="green-text">I am green!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.md
<add>---
<add>id: bad87dee1348bd9aede07836
<add>title: Use an id Attribute to Style an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cakyZfL'
<add>forumTopicId: 18339
<add>dashedName: use-an-id-attribute-to-style-an-element
<add>---
<add>
<add># --description--
<add>
<add>One cool thing about `id` attributes is that, like classes, you can style them using CSS.
<add>
<add>However, an `id` is not reusable and should only be applied to one element. An `id` also has a higher specificity (importance) than a class so if both are applied to the same element and have conflicting styles, the styles of the `id` will be applied.
<add>
<add>Here's an example of how you can take your element with the `id` attribute of `cat-photo-element` and give it the background color of green. In your `style` element:
<add>
<add>```css
<add>#cat-photo-element {
<add> background-color: green;
<add>}
<add>```
<add>
<add>Note that inside your `style` element, you always reference classes by putting a `.` in front of their names. You always reference ids by putting a `#` in front of their names.
<add>
<add># --instructions--
<add>
<add>Try giving your form, which now has the `id` attribute of `cat-photo-form`, a green background.
<add>
<add># --hints--
<add>
<add>Your `form` element should have the id of `cat-photo-form`.
<add>
<add>```js
<add>assert($('form').attr('id') === 'cat-photo-form');
<add>```
<add>
<add>Your `form` element should have the `background-color` of green.
<add>
<add>```js
<add>assert($('#cat-photo-form').css('background-color') === 'rgb(0, 128, 0)');
<add>```
<add>
<add>Your `form` element should have an `id` attribute.
<add>
<add>```js
<add>assert(
<add> code.match(/<form.*cat-photo-form.*>/gi) &&
<add> code.match(/<form.*cat-photo-form.*>/gi).length > 0
<add>);
<add>```
<add>
<add>You should not give your `form` any `class` or `style` attributes.
<add>
<add>```js
<add>assert(!code.match(/<form.*style.*>/gi) && !code.match(/<form.*class.*>/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add>
<add> #cat-photo-form {
<add> background-color: green;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.md
<add>---
<add>id: 58c383d33e2e3259241f3076
<add>title: Use Attribute Selectors to Style Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cnpymfJ'
<add>forumTopicId: 301092
<add>dashedName: use-attribute-selectors-to-style-elements
<add>---
<add>
<add># --description--
<add>
<add>You have been adding `id` or `class` attributes to elements that you wish to specifically style. These are known as ID and class selectors. There are other CSS Selectors you can use to select custom groups of elements to style.
<add>
<add>Let's bring out CatPhotoApp again to practice using CSS Selectors.
<add>
<add>For this challenge, you will use the `[attr=value]` attribute selector to style the checkboxes in CatPhotoApp. This selector matches and styles elements with a specific attribute value. For example, the below code changes the margins of all elements with the attribute `type` and a corresponding value of `radio`:
<add>
<add>```css
<add>[type='radio'] {
<add> margin: 20px 0px 20px 0px;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Using the `type` attribute selector, try to give the checkboxes in CatPhotoApp a top margin of 10px and a bottom margin of 15px.
<add>
<add># --hints--
<add>
<add>The `type` attribute selector should be used to select the checkboxes.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /<style>[\s\S]*?\[\s*?type\s*?=\s*?("|')checkbox\1\s*?\]\s*?{[\s\S]*?}[\s\S]*?<\/style>/gi
<add> )
<add>);
<add>```
<add>
<add>The top margins of the checkboxes should be 10px.
<add>
<add>```js
<add>assert(
<add> (function () {
<add> var count = 0;
<add> $("[type='checkbox']").each(function () {
<add> if ($(this).css('marginTop') === '10px') {
<add> count++;
<add> }
<add> });
<add> return count === 3;
<add> })()
<add>);
<add>```
<add>
<add>The bottom margins of the checkboxes should be 15px.
<add>
<add>```js
<add>assert(
<add> (function () {
<add> var count = 0;
<add> $("[type='checkbox']").each(function () {
<add> if ($(this).css('marginBottom') === '15px') {
<add> count++;
<add> }
<add> });
<add> return count === 3;
<add> })()
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<add><style>
<add> .red-text {
<add> color: red;
<add> }
<add>
<add> h2 {
<add> font-family: Lobster, monospace;
<add> }
<add>
<add> p {
<add> font-size: 16px;
<add> font-family: monospace;
<add> }
<add>
<add> .thick-green-border {
<add> border-color: green;
<add> border-width: 10px;
<add> border-style: solid;
<add> border-radius: 50%;
<add> }
<add>
<add> .smaller-image {
<add> width: 100px;
<add> }
<add>
<add> .silver-background {
<add> background-color: silver;
<add> }
<add> [type='checkbox'] {
<add> margin-top: 10px;
<add> margin-bottom: 15px;
<add> }
<add></style>
<add>
<add><h2 class="red-text">CatPhotoApp</h2>
<add><main>
<add> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div class="silver-background">
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.md
<add>---
<add>id: bad87fee1348bd9afdf08726
<add>title: Use Clockwise Notation to Specify the Margin of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cnpybAd'
<add>forumTopicId: 18345
<add>dashedName: use-clockwise-notation-to-specify-the-margin-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Let's try this again, but with `margin` this time.
<add>
<add>Instead of specifying an element's `margin-top`, `margin-right`, `margin-bottom`, and `margin-left` properties individually, you can specify them all in one line, like this:
<add>
<add>```css
<add>margin: 10px 20px 10px 20px;
<add>```
<add>
<add>These four values work like a clock: top, right, bottom, left, and will produce the exact same result as using the side-specific margin instructions.
<add>
<add># --instructions--
<add>
<add>Use Clockwise Notation to give the element with the `blue-box` class a margin of `40px` on its top and left side, but only `20px` on its bottom and right side.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give the top of elements `40px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-top') === '40px');
<add>```
<add>
<add>Your `blue-box` class should give the right of elements `20px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-right') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the bottom of elements `20px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-bottom') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the left of elements `40px` of `margin`.
<add>
<add>```js
<add>assert($('.blue-box').css('margin-left') === '40px');
<add>```
<add>
<add>You should use the clockwise notation to set the margin of `blue-box` class.
<add>
<add>```js
<add>assert(
<add> /\.blue-box\s*{[\s\S]*margin[\s]*:\s*\d+px\s+\d+px\s+\d+px\s+\d+px(;\s*[^}]+\s*}|;?\s*})/.test(
<add> __helpers.removeCssComments($('style').text())
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> margin: 20px 40px 20px 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> margin: 20px 40px 20px 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> margin: 40px 20px 20px 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.md
<add>---
<add>id: bad87fee1348bd9aedf08826
<add>title: Use Clockwise Notation to Specify the Padding of an Element
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cB7mBS9'
<add>forumTopicId: 18346
<add>dashedName: use-clockwise-notation-to-specify-the-padding-of-an-element
<add>---
<add>
<add># --description--
<add>
<add>Instead of specifying an element's `padding-top`, `padding-right`, `padding-bottom`, and `padding-left` properties individually, you can specify them all in one line, like this:
<add>
<add>```css
<add>padding: 10px 20px 10px 20px;
<add>```
<add>
<add>These four values work like a clock: top, right, bottom, left, and will produce the exact same result as using the side-specific padding instructions.
<add>
<add># --instructions--
<add>
<add>Use Clockwise Notation to give the `.blue-box` class a `padding` of `40px` on its top and left side, but only `20px` on its bottom and right side.
<add>
<add># --hints--
<add>
<add>Your `blue-box` class should give the top of elements `40px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-top') === '40px');
<add>```
<add>
<add>Your `blue-box` class should give the right of elements `20px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-right') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the bottom of elements `20px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-bottom') === '20px');
<add>```
<add>
<add>Your `blue-box` class should give the left of elements `40px` of `padding`.
<add>
<add>```js
<add>assert($('.blue-box').css('padding-left') === '40px');
<add>```
<add>
<add>You should use the clockwise notation to set the padding of `blue-box` class.
<add>
<add>```js
<add>assert(
<add> /\.blue-box\s*{[\s\S]*padding[\s]*:\s*\d+px\s+\d+px\s+\d+px\s+\d+px(;\s*[^}]+\s*}|;?\s*})/.test(
<add> __helpers.removeCssComments($('style').text())
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> padding: 20px 40px 20px 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> padding: 40px 20px 20px 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-css-selectors-to-style-elements.md
<add>---
<add>id: bad87fee1348bd9aedf08805
<add>title: Use CSS Selectors to Style Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cJKMBT2'
<add>forumTopicId: 18349
<add>dashedName: use-css-selectors-to-style-elements
<add>---
<add>
<add># --description--
<add>
<add>With CSS, there are hundreds of CSS properties that you can use to change the way an element looks on your page.
<add>
<add>When you entered `<h2 style="color: red;">CatPhotoApp</h2>`, you were styling that individual `h2` element with inline CSS, which stands for Cascading Style Sheets.
<add>
<add>That's one way to specify the style of an element, but there's a better way to apply CSS.
<add>
<add>At the top of your code, create a `style` block like this:
<add>
<add>```html
<add><style>
<add></style>
<add>```
<add>
<add>Inside that style block, you can create a <dfn>CSS selector</dfn> for all `h2` elements. For example, if you wanted all `h2` elements to be red, you would add a style rule that looks like this:
<add>
<add>```html
<add><style>
<add> h2 {
<add> color: red;
<add> }
<add></style>
<add>```
<add>
<add>Note that it's important to have both opening and closing curly braces (`{` and `}`) around each element's style rule(s). You also need to make sure that your element's style definition is between the opening and closing style tags. Finally, be sure to add a semicolon to the end of each of your element's style rules.
<add>
<add># --instructions--
<add>
<add>Delete your `h2` element's style attribute, and instead create a CSS `style` block. Add the necessary CSS to turn all `h2` elements blue.
<add>
<add># --hints--
<add>
<add>The `style` attribute should be removed from your `h2` element.
<add>
<add>```js
<add>assert(!$('h2').attr('style'));
<add>```
<add>
<add>You should create a `style` element.
<add>
<add>```js
<add>assert($('style') && $('style').length >= 1);
<add>```
<add>
<add>Your `h2` element should be blue.
<add>
<add>```js
<add>assert($('h2').css('color') === 'rgb(0, 0, 255)');
<add>```
<add>
<add>Your stylesheet `h2` declaration should be valid with a semicolon and closing brace.
<add>
<add>```js
<add>assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g));
<add>```
<add>
<add>All your `style` elements should be valid and have closing tags.
<add>
<add>```js
<add>assert(
<add> code.match(/<\/style>/g) &&
<add> code.match(/<\/style>/g).length ===
<add> (
<add> code.match(
<add> /<style((\s)*((type|media|scoped|title|disabled)="[^"]*")?(\s)*)*>/g
<add> ) || []
<add> ).length
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><h2 style="color: red;">CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> h2 {
<add> color: blue;
<add> }
<add></style>
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add>
<add> <form action="https://freecatphotoapp.com/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.md
<add>---
<add>id: 5a9d725e424fe3d0e10cad10
<add>title: Use CSS Variables to change several elements at once
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c6bDECm'
<add>forumTopicId: 301093
<add>dashedName: use-css-variables-to-change-several-elements-at-once
<add>---
<add>
<add># --description--
<add>
<add><dfn>CSS Variables</dfn> are a powerful way to change many CSS style properties at once by changing only one value.
<add>
<add>Follow the instructions below to see how changing just three values can change the styling of many elements.
<add>
<add># --instructions--
<add>
<add>In the `penguin` class, change the `black` value to `gray`, the `gray` value to `white`, and the `yellow` value to `orange`.
<add>
<add># --hints--
<add>
<add>`penguin` class should declare the `--penguin-skin` variable and assign it to `gray`.
<add>
<add>```js
<add>assert(
<add> code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add>`penguin` class should declare the `--penguin-belly` variable and assign it to `white`.
<add>
<add>```js
<add>assert(
<add> code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add>`penguin` class should declare the `--penguin-beak` variable and assign it to `orange`.
<add>
<add>```js
<add>assert(
<add> code.match(/.penguin\s*?{[\s\S]*--penguin-beak\s*?:\s*?orange\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .penguin {
<add>
<add> /* Only change code below this line */
<add> --penguin-skin: black;
<add> --penguin-belly: gray;
<add> --penguin-beak: yellow;
<add> /* Only change code above this line */
<add>
<add> position: relative;
<add> margin: auto;
<add> display: block;
<add> margin-top: 5%;
<add> width: 300px;
<add> height: 300px;
<add> }
<add>
<add> .penguin-top {
<add> top: 10%;
<add> left: 25%;
<add> background: var(--penguin-skin, gray);
<add> width: 50%;
<add> height: 45%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .penguin-bottom {
<add> top: 40%;
<add> left: 23.5%;
<add> background: var(--penguin-skin, gray);
<add> width: 53%;
<add> height: 45%;
<add> border-radius: 70% 70% 100% 100%;
<add> }
<add>
<add> .right-hand {
<add> top: 0%;
<add> left: -5%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 120% 30%;
<add> transform: rotate(45deg);
<add> z-index: -1;
<add> }
<add>
<add> .left-hand {
<add> top: 0%;
<add> left: 75%;
<add> background: var(--penguin-skin, gray);
<add> width: 30%;
<add> height: 60%;
<add> border-radius: 30% 30% 30% 120%;
<add> transform: rotate(-45deg);
<add> z-index: -1;
<add> }
<add>
<add> .right-cheek {
<add> top: 15%;
<add> left: 35%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .left-cheek {
<add> top: 15%;
<add> left: 5%;
<add> background: var(--penguin-belly, white);
<add> width: 60%;
<add> height: 70%;
<add> border-radius: 70% 70% 60% 60%;
<add> }
<add>
<add> .belly {
<add> top: 60%;
<add> left: 2.5%;
<add> background: var(--penguin-belly, white);
<add> width: 95%;
<add> height: 100%;
<add> border-radius: 120% 120% 100% 100%;
<add> }
<add>
<add> .right-feet {
<add> top: 85%;
<add> left: 60%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(-80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .left-feet {
<add> top: 85%;
<add> left: 25%;
<add> background: var(--penguin-beak, orange);
<add> width: 15%;
<add> height: 30%;
<add> border-radius: 50% 50% 50% 50%;
<add> transform: rotate(80deg);
<add> z-index: -2222;
<add> }
<add>
<add> .right-eye {
<add> top: 45%;
<add> left: 60%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .left-eye {
<add> top: 45%;
<add> left: 25%;
<add> background: black;
<add> width: 15%;
<add> height: 17%;
<add> border-radius: 50%;
<add> }
<add>
<add> .sparkle {
<add> top: 25%;
<add> left: 15%;
<add> background: white;
<add> width: 35%;
<add> height: 35%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-right {
<add> top: 65%;
<add> left: 15%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .blush-left {
<add> top: 65%;
<add> left: 70%;
<add> background: pink;
<add> width: 15%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-top {
<add> top: 60%;
<add> left: 40%;
<add> background: var(--penguin-beak, orange);
<add> width: 20%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> .beak-bottom {
<add> top: 65%;
<add> left: 42%;
<add> background: var(--penguin-beak, orange);
<add> width: 16%;
<add> height: 10%;
<add> border-radius: 50%;
<add> }
<add>
<add> body {
<add> background:#c6faf1;
<add> }
<add>
<add> .penguin * {
<add> position: absolute;
<add> }
<add></style>
<add><div class="penguin">
<add> <div class="penguin-bottom">
<add> <div class="right-hand"></div>
<add> <div class="left-hand"></div>
<add> <div class="right-feet"></div>
<add> <div class="left-feet"></div>
<add> </div>
<add> <div class="penguin-top">
<add> <div class="right-cheek"></div>
<add> <div class="left-cheek"></div>
<add> <div class="belly"></div>
<add> <div class="right-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="left-eye">
<add> <div class="sparkle"></div>
<add> </div>
<add> <div class="blush-right"></div>
<add> <div class="blush-left"></div>
<add> <div class="beak-top"></div>
<add> <div class="beak-bottom"></div>
<add> </div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.penguin {--penguin-skin: gray; --penguin-belly: white; --penguin-beak: orange;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.md
<add>---
<add>id: bad87fee1348bd9aedf08726
<add>title: Use Hex Code for Specific Colors
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/c8W9mHM'
<add>forumTopicId: 18350
<add>dashedName: use-hex-code-for-specific-colors
<add>---
<add>
<add># --description--
<add>
<add>Did you know there are other ways to represent colors in CSS? One of these ways is called hexadecimal code, or hex code for short.
<add>
<add>We usually use <dfn>decimals</dfn>, or base 10 numbers, which use the symbols 0 to 9 for each digit. <dfn>Hexadecimals</dfn> (or <dfn>hex</dfn>) are base 16 numbers. This means it uses sixteen distinct symbols. Like decimals, the symbols 0-9 represent the values zero to nine. Then A,B,C,D,E,F represent the values ten to fifteen. Altogether, 0 to F can represent a digit in hexadecimal, giving us 16 total possible values. You can find more information about [hexadecimal numbers here](https://en.wikipedia.org/wiki/Hexadecimal).
<add>
<add>In CSS, we can use 6 hexadecimal digits to represent colors, two each for the red (R), green (G), and blue (B) components. For example, `#000000` is black and is also the lowest possible value. You can find more information about the [RGB color system here](https://en.wikipedia.org/wiki/RGB_color_model).
<add>
<add>```css
<add>body {
<add> color: #000000;
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Replace the word `black` in our `body` element's background-color with its hex code representation, `#000000`.
<add>
<add># --hints--
<add>
<add>Your `body` element should have the background-color of black.
<add>
<add>```js
<add>assert($('body').css('background-color') === 'rgb(0, 0, 0)');
<add>```
<add>
<add>The `hex code` for the color black should be used instead of the word `black`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /body\s*{(([\s\S]*;\s*?)|\s*?)background.*\s*:\s*?#000(000)?((\s*})|(;[\s\S]*?}))/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: black;
<add> }
<add></style>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #000000;
<add> }
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.md
<add>---
<add>id: bad87fee1348bd9aedf08721
<add>title: Use Hex Code to Mix Colors
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cK89PhP'
<add>forumTopicId: 18359
<add>dashedName: use-hex-code-to-mix-colors
<add>---
<add>
<add># --description--
<add>
<add>To review, hex codes use 6 hexadecimal digits to represent colors, two each for red (R), green (G), and blue (B) components.
<add>
<add>From these three pure colors (red, green, and blue), we can vary the amounts of each to create over 16 million other colors!
<add>
<add>For example, orange is pure red, mixed with some green, and no blue. In hex code, this translates to being `#FFA500`.
<add>
<add>The digit `0` is the lowest number in hex code, and represents a complete absence of color.
<add>
<add>The digit `F` is the highest number in hex code, and represents the maximum possible brightness.
<add>
<add># --instructions--
<add>
<add>Replace the color words in our `style` element with their correct hex codes.
<add>
<add><table class='table table-striped'><tbody><tr><th>Color</th><th>Hex Code</th></tr><tr><td>Dodger Blue</td><td><code>#1E90FF</code></td></tr><tr><td>Green</td><td><code>#00FF00</code></td></tr><tr><td>Orange</td><td><code>#FFA500</code></td></tr><tr><td>Red</td><td><code>#FF0000</code></td></tr></tbody></table>
<add>
<add># --hints--
<add>
<add>Your `h1` element with the text `I am red!` should be given the `color` red.
<add>
<add>```js
<add>assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>The `hex code` for the color red should be used instead of the word `red`.
<add>
<add>```js
<add>assert(code.match(/\.red-text\s*?{\s*?color\s*:\s*?(#FF0000|#F00)\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am green!` should be given the `color` green.
<add>
<add>```js
<add>assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
<add>```
<add>
<add>The `hex code` for the color green should be used instead of the word `green`.
<add>
<add>```js
<add>assert(code.match(/\.green-text\s*?{\s*?color\s*:\s*?(#00FF00|#0F0)\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am dodger blue!` should be given the `color` dodger blue.
<add>
<add>```js
<add>assert($('.dodger-blue-text').css('color') === 'rgb(30, 144, 255)');
<add>```
<add>
<add>The `hex code` for the color dodger blue should be used instead of the word `dodgerblue`.
<add>
<add>```js
<add>assert(code.match(/\.dodger-blue-text\s*?{\s*?color\s*:\s*?#1E90FF\s*?;?\s*?}/gi));
<add>```
<add>
<add>Your `h1` element with the text `I am orange!` should be given the `color` orange.
<add>
<add>```js
<add>assert($('.orange-text').css('color') === 'rgb(255, 165, 0)');
<add>```
<add>
<add>The `hex code` for the color orange should be used instead of the word `orange`.
<add>
<add>```js
<add>assert(code.match(/\.orange-text\s*?{\s*?color\s*:\s*?#FFA500\s*?;?\s*?}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: black;
<add> }
<add> .green-text {
<add> color: black;
<add> }
<add> .dodger-blue-text {
<add> color: black;
<add> }
<add> .orange-text {
<add> color: black;
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="green-text">I am green!</h1>
<add>
<add><h1 class="dodger-blue-text">I am dodger blue!</h1>
<add>
<add><h1 class="orange-text">I am orange!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: #FF0000;
<add> }
<add> .green-text {
<add> color: #00FF00;
<add> }
<add> .dodger-blue-text {
<add> color: #1E90FF;
<add> }
<add> .orange-text {
<add> color: #FFA500;
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="green-text">I am green!</h1>
<add>
<add><h1 class="dodger-blue-text">I am dodger blue!</h1>
<add>
<add><h1 class="orange-text">I am orange!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.md
<add>---
<add>id: bad82fee1348bd9aedf08721
<add>title: Use RGB to Mix Colors
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cm24JU6'
<add>forumTopicId: 18368
<add>dashedName: use-rgb-to-mix-colors
<add>---
<add>
<add># --description--
<add>
<add>Just like with hex code, you can mix colors in RGB by using combinations of different values.
<add>
<add># --instructions--
<add>
<add>Replace the hex codes in our `style` element with their correct RGB values.
<add>
<add><table class='table table-striped'><tbody><tr><th>Color</th><th>RGB</th></tr><tr><td>Blue</td><td><code>rgb(0, 0, 255)</code></td></tr><tr><td>Red</td><td><code>rgb(255, 0, 0)</code></td></tr><tr><td>Orchid</td><td><code>rgb(218, 112, 214)</code></td></tr><tr><td>Sienna</td><td><code>rgb(160, 82, 45)</code></td></tr></tbody></table>
<add>
<add># --hints--
<add>
<add>Your `h1` element with the text `I am red!` should have the `color` red.
<add>
<add>```js
<add>assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
<add>```
<add>
<add>You should use `rgb` for the color red.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /\.red-text\s*{\s*color\s*:\s*rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)\s*;?\s*}/gi
<add> )
<add>);
<add>```
<add>
<add>Your `h1` element with the text `I am orchid!` should have the `color` orchid.
<add>
<add>```js
<add>assert($('.orchid-text').css('color') === 'rgb(218, 112, 214)');
<add>```
<add>
<add>You should use `rgb` for the color orchid.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /\.orchid-text\s*{\s*color\s*:\s*rgb\(\s*218\s*,\s*112\s*,\s*214\s*\)\s*;?\s*}/gi
<add> )
<add>);
<add>```
<add>
<add>Your `h1` element with the text `I am blue!` should have the `color` blue.
<add>
<add>```js
<add>assert($('.blue-text').css('color') === 'rgb(0, 0, 255)');
<add>```
<add>
<add>You should use `rgb` for the color blue.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /\.blue-text\s*{\s*color\s*:\s*rgb\(\s*0\s*,\s*0\s*,\s*255\s*\)\s*;?\s*}/gi
<add> )
<add>);
<add>```
<add>
<add>Your `h1` element with the text `I am sienna!` should have the `color` sienna.
<add>
<add>```js
<add>assert($('.sienna-text').css('color') === 'rgb(160, 82, 45)');
<add>```
<add>
<add>You should use `rgb` for the color sienna.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /\.sienna-text\s*{\s*color\s*:\s*rgb\(\s*160\s*,\s*82\s*,\s*45\s*\)\s*;?\s*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: #000000;
<add> }
<add> .orchid-text {
<add> color: #000000;
<add> }
<add> .sienna-text {
<add> color: #000000;
<add> }
<add> .blue-text {
<add> color: #000000;
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="orchid-text">I am orchid!</h1>
<add>
<add><h1 class="sienna-text">I am sienna!</h1>
<add>
<add><h1 class="blue-text">I am blue!</h1>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .red-text {
<add> color: rgb(255, 0, 0);
<add> }
<add> .orchid-text {
<add> color: rgb(218, 112, 214);
<add> }
<add> .sienna-text {
<add> color: rgb(160, 82, 45);
<add> }
<add> .blue-text {
<add> color:rgb(0, 0, 255);
<add> }
<add></style>
<add>
<add><h1 class="red-text">I am red!</h1>
<add>
<add><h1 class="orchid-text">I am orchid!</h1>
<add>
<add><h1 class="sienna-text">I am sienna!</h1>
<add>
<add><h1 class="blue-text">I am blue!</h1>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.md
<add>---
<add>id: bad87fee1348bd9aede08718
<add>title: Use RGB values to Color Elements
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/c/cRkp2fr'
<add>forumTopicId: 18369
<add>dashedName: use-rgb-values-to-color-elements
<add>---
<add>
<add># --description--
<add>
<add>Another way you can represent colors in CSS is by using `RGB` values.
<add>
<add>The `RGB` value for black looks like this:
<add>
<add>```css
<add>rgb(0, 0, 0)
<add>```
<add>
<add>The `RGB` value for white looks like this:
<add>
<add>```css
<add>rgb(255, 255, 255)
<add>```
<add>
<add>Instead of using six hexadecimal digits like you do with hex code, with `RGB` you specify the brightness of each color with a number between 0 and 255.
<add>
<add>If you do the math, the two digits for one color equal 16 times 16, which gives us 256 total values. So `RGB`, which starts counting from zero, has the exact same number of possible values as hex code.
<add>
<add>Here's an example of how you'd change the `body` background to orange using its RGB code.
<add>
<add>```css
<add>body {
<add> background-color: rgb(255, 165, 0);
<add>}
<add>```
<add>
<add># --instructions--
<add>
<add>Let's replace the hex code in our `body` element's background color with the RGB value for black: `rgb(0, 0, 0)`
<add>
<add># --hints--
<add>
<add>Your `body` element should have a black background.
<add>
<add>```js
<add>assert($('body').css('background-color') === 'rgb(0, 0, 0)');
<add>```
<add>
<add>You should use `rgb` to give your `body` element a background of black.
<add>
<add>```js
<add>assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: #F00;
<add> }
<add></style>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> background-color: rgb(0, 0, 0);
<add> }
<add></style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.md
<add>---
<add>id: 587d78ab367417b2b2512af1
<add>title: Add Flex Superpowers to the Tweet Embed
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c9W7MhM'
<add>forumTopicId: 301100
<add>dashedName: add-flex-superpowers-to-the-tweet-embed
<add>---
<add>
<add># --description--
<add>
<add>To the right is the tweet embed that will be used as a practical example. Some of the elements would look better with a different layout. The last challenge demonstrated `display: flex`. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `display: flex` to all of the following items - note that the selectors are already set up in the CSS:
<add>
<add>`header`, the header's `.profile-name`, the header's `.follow-btn`, the header's `h3` and `h4`, the `footer`, and the footer's `.stats`.
<add>
<add># --hints--
<add>
<add>Your `.follow-btn` should be rendered on the page. Be sure to turn off any extensions such as ad blockers.
<add>
<add>```js
<add>assert($('.follow-btn').length > 0 && $('.follow-btn').css('display') !== 'none');
<add>```
<add>
<add>Your `header` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('header').css('display') == 'flex');
<add>```
<add>
<add>Your `footer` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('footer').css('display') == 'flex');
<add>```
<add>
<add>Your `h3` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('h3').css('display') == 'flex');
<add>```
<add>
<add>Your `h4` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('h4').css('display') == 'flex');
<add>```
<add>
<add>Your `.profile-name` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('.profile-name').css('display') == 'flex');
<add>```
<add>
<add>Your `.follow-btn` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('.follow-btn').css('display') == 'flex');
<add>```
<add>
<add>Your `.stats` should have a `display` property set to `flex`.
<add>
<add>```js
<add>assert($('.stats').css('display') == 'flex');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header {
<add>
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add>
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add>
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add>
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer {
<add>
<add> }
<add> footer .stats {
<add>
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header {
<add> display: flex;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer {
<add> display: flex;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.md
<add>---
<add>id: 587d78ad367417b2b2512af8
<add>title: Align Elements Using the align-items Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c8aggtk'
<add>forumTopicId: 301101
<add>dashedName: align-elements-using-the-align-items-property
<add>---
<add>
<add># --description--
<add>
<add>The `align-items` property is similar to `justify-content`. Recall that the `justify-content` property aligned flex items along the main axis. For rows, the main axis is a horizontal line and for columns it is a vertical line.
<add>
<add>Flex containers also have a **cross axis** which is the opposite of the main axis. For rows, the cross axis is vertical and for columns, the cross axis is horizontal.
<add>
<add>CSS offers the `align-items` property to align flex items along the cross axis. For a row, it tells CSS how to push the items in the entire row up or down within the container. And for a column, how to push all the items left or right within the container.
<add>
<add>The different values available for `align-items` include:
<add>
<add><ul><li><code>flex-start</code>: aligns items to the start of the flex container. For rows, this aligns items to the top of the container. For columns, this aligns items to the left of the container.</li><li><code>flex-end</code>: aligns items to the end of the flex container. For rows, this aligns items to the bottom of the container. For columns, this aligns items to the right of the container.</li><li><code>center</code>: align items to the center. For rows, this vertically aligns items (equal space above and below the items). For columns, this horizontally aligns them (equal space to the left and right of the items).</li><li><code>stretch</code>: stretch the items to fill the flex container. For example, rows items are stretched to fill the flex container top-to-bottom. This is the default value if no <code>align-items</code> value is specified.</li><li><code>baseline</code>: align items to their baselines. Baseline is a text concept, think of it as the line that the letters sit on.</li></ul>
<add>
<add># --instructions--
<add>
<add>An example helps show this property in action. Add the CSS property `align-items` to the `#box-container` element, and give it a value of `center`.
<add>
<add>**Bonus**
<add>Try the other options for the `align-items` property in the code editor to see their differences. But note that a value of `center` is the only one that will pass this challenge.
<add>
<add># --hints--
<add>
<add>The `#box-container` element should have an `align-items` property set to a value of `center`.
<add>
<add>```js
<add>assert($('#box-container').css('align-items') == 'center');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 500px;
<add>
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 200px;
<add> font-size: 24px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 200px;
<add> font-size: 18px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"><p>Hello</p></div>
<add> <div id="box-2"><p>Goodbye</p></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 500px;
<add> align-items: center;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 200px;
<add> font-size: 24px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 200px;
<add> font-size: 18px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"><p>Hello</p></div>
<add> <div id="box-2"><p>Goodbye</p></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.md
<add>---
<add>id: 587d78ac367417b2b2512af6
<add>title: Align Elements Using the justify-content Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c43gnHm'
<add>forumTopicId: 301102
<add>dashedName: align-elements-using-the-justify-content-property
<add>---
<add>
<add># --description--
<add>
<add>Sometimes the flex items within a flex container do not fill all the space in the container. It is common to want to tell CSS how to align and space out the flex items a certain way. Fortunately, the `justify-content` property has several options to do this. But first, there is some important terminology to understand before reviewing those options.
<add>
<add>[Here is a useful image showing a row to illustrate the concepts below.](https://www.w3.org/TR/css-flexbox-1/images/flex-direction-terms.svg)
<add>
<add>Recall that setting a flex container as a row places the flex items side-by-side from left-to-right. A flex container set as a column places the flex items in a vertical stack from top-to-bottom. For each, the direction the flex items are arranged is called the **main axis**. For a row, this is a horizontal line that cuts through each item. And for a column, the main axis is a vertical line through the items.
<add>
<add>There are several options for how to space the flex items along the line that is the main axis. One of the most commonly used is `justify-content: center;`, which aligns all the flex items to the center inside the flex container. Other options include:
<add>
<add><ul><li><code>flex-start</code>: aligns items to the start of the flex container. For a row, this pushes the items to the left of the container. For a column, this pushes the items to the top of the container. This is the default alignment if no <code>justify-content</code> is specified.</li><li><code>flex-end</code>: aligns items to the end of the flex container. For a row, this pushes the items to the right of the container. For a column, this pushes the items to the bottom of the container.</li><li><code>space-between</code>: aligns items to the center of the main axis, with extra space placed between the items. The first and last items are pushed to the very edge of the flex container. For example, in a row the first item is against the left side of the container, the last item is against the right side of the container, then the remaining space is distributed evenly among the other items.</li><li><code>space-around</code>: similar to <code>space-between</code> but the first and last items are not locked to the edges of the container, the space is distributed around all the items with a half space on either end of the flex container.</li><li><code>space-evenly</code>: Distributes space evenly between the flex items with a full space at either end of the flex container</li></ul>
<add>
<add># --instructions--
<add>
<add>An example helps show this property in action. Add the CSS property `justify-content` to the `#box-container` element, and give it a value of `center`.
<add>
<add>**Bonus**
<add>Try the other options for the `justify-content` property in the code editor to see their differences. But note that a value of `center` is the only one that will pass this challenge.
<add>
<add># --hints--
<add>
<add>The `#box-container` element should have a `justify-content` property set to a value of `center`.
<add>
<add>```js
<add>assert($('#box-container').css('justify-content') == 'center');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 500px;
<add>
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 25%;
<add> height: 100%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 25%;
<add> height: 100%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 500px;
<add> justify-content: center;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 25%;
<add> height: 100%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 25%;
<add> height: 100%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.md
<add>---
<add>id: 587d78ac367417b2b2512af5
<add>title: Apply the flex-direction Property to Create a Column in the Tweet Embed
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cnzdVC9'
<add>forumTopicId: 301103
<add>dashedName: apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed
<add>---
<add>
<add># --description--
<add>
<add>The tweet embed `header` and `footer` used the `flex-direction` property earlier with a row value. Similarly, the items inside the `.profile-name` element would work well stacked as a column.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-direction` to the header's `.profile-name` element and set the value to `column`.
<add>
<add># --hints--
<add>
<add>Your `.follow-btn` should be rendered on the page. Be sure to turn off any extensions such as ad blockers.
<add>
<add>```js
<add>assert($('.follow-btn').length > 0 && $('.follow-btn').css('display') !== 'none');
<add>```
<add>
<add>The `.profile-name` element should have a `flex-direction` property set to `column`.
<add>
<add>```js
<add>assert($('.profile-name').css('flex-direction') == 'column');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add>
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> flex-direction: column;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.md
<add>---
<add>id: 587d78ab367417b2b2512af3
<add>title: Apply the flex-direction Property to Create Rows in the Tweet Embed
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cJb8yuq'
<add>forumTopicId: 301104
<add>dashedName: apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed
<add>---
<add>
<add># --description--
<add>
<add>The `header` and `footer` in the tweet embed example have child items that could be arranged as rows using the `flex-direction` property. This tells CSS to align the children horizontally.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-direction` to both the `header` and `footer` and set the value to `row`.
<add>
<add># --hints--
<add>
<add>Your `.follow-btn` should be rendered on the page. Be sure to turn off any extensions such as ad blockers.
<add>
<add>```js
<add>assert($('.follow-btn').length > 0 && $('.follow-btn').css('display') !== 'none');
<add>```
<add>
<add>The `header` should have a `flex-direction` property set to `row`.
<add>
<add>```js
<add>assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g));
<add>```
<add>
<add>The `footer` should have a `flex-direction` property set to `row`.
<add>
<add>```js
<add>assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header {
<add> display: flex;
<add>
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer {
<add> display: flex;
<add>
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.md
<add>---
<add>id: 587d78ab367417b2b2512af0
<add>title: 'Use display: flex to Position Two Boxes'
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cgz3QS7'
<add>forumTopicId: 301105
<add>dashedName: use-display-flex-to-position-two-boxes
<add>---
<add>
<add># --description--
<add>
<add>This section uses alternating challenge styles to show how to use CSS to position elements in a flexible way. First, a challenge will explain theory, then a practical challenge using a simple tweet component will apply the flexbox concept.
<add>
<add>Placing the CSS property `display: flex;` on an element allows you to use other flex properties to build a responsive page.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `display` to `#box-container` and set its value to `flex`.
<add>
<add># --hints--
<add>
<add>`#box-container` should have the `display` property set to a value of `flex`.
<add>
<add>```js
<add>assert($('#box-container').css('display') == 'flex');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> height: 500px;
<add>
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> height: 500px;
<add> display: flex;
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.md
<add>---
<add>id: 587d78ad367417b2b2512af9
<add>title: Use the align-items Property in the Tweet Embed
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cd3PNfq'
<add>forumTopicId: 301106
<add>dashedName: use-the-align-items-property-in-the-tweet-embed
<add>---
<add>
<add># --description--
<add>
<add>The last challenge introduced the `align-items` property and gave an example. This property can be applied to a few tweet embed elements to align the flex items inside them.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `align-items` to the header's `.follow-btn` element. Set the value to `center`.
<add>
<add># --hints--
<add>
<add>Your `.follow-btn` should be rendered on the page. Be sure to turn off any extensions such as ad blockers.
<add>
<add>```js
<add>assert($('.follow-btn').length > 0 && $('.follow-btn').css('display') !== 'none');
<add>```
<add>
<add>The `.follow-btn` element should have the `align-items` property set to a value of `center`.
<add>
<add>```js
<add>assert($('.follow-btn').css('align-items') == 'center');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> flex-direction: column;
<add> justify-content: center;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add>
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> flex-direction: column;
<add> justify-content: center;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> align-items: center;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-align-self-property.md
<add>---
<add>id: 587d78af367417b2b2512b00
<add>title: Use the align-self Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvzfv'
<add>forumTopicId: 301107
<add>dashedName: use-the-align-self-property
<add>---
<add>
<add># --description--
<add>
<add>The final property for flex items is `align-self`. This property allows you to adjust each item's alignment individually, instead of setting them all at once. This is useful since other common adjustment techniques using the CSS properties `float`, `clear`, and `vertical-align` do not work on flex items.
<add>
<add>`align-self` accepts the same values as `align-items` and will override any value set by the `align-items` property.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `align-self` to both `#box-1` and `#box-2`. Give `#box-1` a value of `center` and give `#box-2` a value of `flex-end`.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `align-self` property set to a value of `center`.
<add>
<add>```js
<add>assert($('#box-1').css('align-self') == 'center');
<add>```
<add>
<add>The `#box-2` element should have the `align-self` property set to a value of `flex-end`.
<add>
<add>```js
<add>assert($('#box-2').css('align-self') == 'flex-end');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add>
<add> height: 200px;
<add> width: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add>
<add> height: 200px;
<add> width: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> align-self: center;
<add> height: 200px;
<add> width: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> align-self: flex-end;
<add> height: 200px;
<add> width: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.md
<add>---
<add>id: 587d78ae367417b2b2512afd
<add>title: Use the flex-basis Property to Set the Initial Size of an Item
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c3d9nCa'
<add>forumTopicId: 301108
<add>dashedName: use-the-flex-basis-property-to-set-the-initial-size-of-an-item
<add>---
<add>
<add># --description--
<add>
<add>The `flex-basis` property specifies the initial size of the item before CSS makes adjustments with `flex-shrink` or `flex-grow`.
<add>
<add>The units used by the `flex-basis` property are the same as other size properties (`px`, `em`, `%`, etc.). The value `auto` sizes items based on the content.
<add>
<add># --instructions--
<add>
<add>Set the initial size of the boxes using `flex-basis`. Add the CSS property `flex-basis` to both `#box-1` and `#box-2`. Give `#box-1` a value of `10em` and `#box-2` a value of `20em`.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `flex-basis` property.
<add>
<add>```js
<add>assert($('#box-1').css('flex-basis') != 'auto');
<add>```
<add>
<add>The `#box-1` element should have a `flex-basis` value of `10em`.
<add>
<add>```js
<add>assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g));
<add>```
<add>
<add>The `#box-2` element should have the `flex-basis` property.
<add>
<add>```js
<add>assert($('#box-2').css('flex-basis') != 'auto');
<add>```
<add>
<add>The `#box-2` element should have a `flex-basis` value of `20em`.
<add>
<add>```js
<add>assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> height: 200px;
<add>
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> height: 200px;
<add>
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> height: 200px;
<add> flex-basis: 10em;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> height: 200px;
<add> flex-basis: 20em;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.md
<add>---
<add>id: 587d78ac367417b2b2512af4
<add>title: Use the flex-direction Property to Make a Column
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cZmWeA4'
<add>forumTopicId: 301109
<add>dashedName: use-the-flex-direction-property-to-make-a-column
<add>---
<add>
<add># --description--
<add>
<add>The last two challenges used the `flex-direction` property set to `row`. This property can also create a column by vertically stacking the children of a flex container.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-direction` to the `#box-container` element, and give it a value of `column`.
<add>
<add># --hints--
<add>
<add>The `#box-container` element should have a `flex-direction` property set to `column`.
<add>
<add>```js
<add>assert($('#box-container').css('flex-direction') == 'column');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add>
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> flex-direction: column;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.md
<add>---
<add>id: 587d78ab367417b2b2512af2
<add>title: Use the flex-direction Property to Make a Row
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cBEkbfJ'
<add>forumTopicId: 301110
<add>dashedName: use-the-flex-direction-property-to-make-a-row
<add>---
<add>
<add># --description--
<add>
<add>Adding `display: flex` to an element turns it into a flex container. This makes it possible to align any children of that element into rows or columns. You do this by adding the `flex-direction` property to the parent item and setting it to row or column. Creating a row will align the children horizontally, and creating a column will align the children vertically.
<add>
<add>Other options for `flex-direction` are `row-reverse` and `column-reverse`.
<add>
<add>**Note:** The default value for the `flex-direction` property is `row`.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-direction` to the `#box-container` element, and give it a value of `row-reverse`.
<add>
<add># --hints--
<add>
<add>The `#box-container` element should have a `flex-direction` property set to `row-reverse`.
<add>
<add>```js
<add>assert($('#box-container').css('flex-direction') == 'row-reverse');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add>
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> flex-direction: row-reverse;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 50%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 50%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.md
<add>---
<add>id: 587d78ae367417b2b2512afc
<add>title: Use the flex-grow Property to Expand Items
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c2p78cg'
<add>forumTopicId: 301111
<add>dashedName: use-the-flex-grow-property-to-expand-items
<add>---
<add>
<add># --description--
<add>
<add>The opposite of `flex-shrink` is the `flex-grow` property. Recall that `flex-shrink` controls the size of the items when the container shrinks. The `flex-grow` property controls the size of items when the parent container expands.
<add>
<add>Using a similar example from the last challenge, if one item has a `flex-grow` value of `1` and the other has a `flex-grow` value of `3`, the one with the value of `3` will grow three times as much as the other.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-grow` to both `#box-1` and `#box-2`. Give `#box-1` a value of `1` and `#box-2` a value of `2`.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `flex-grow` property set to a value of `1`.
<add>
<add>```js
<add>assert($('#box-1').css('flex-grow') == '1');
<add>```
<add>
<add>The `#box-2` element should have the `flex-grow` property set to a value of `2`.
<add>
<add>```js
<add>assert($('#box-2').css('flex-grow') == '2');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> height: 200px;
<add>
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> height: 200px;
<add>
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add>
<add> #box-1 {
<add> background-color: dodgerblue;
<add> height: 200px;
<add> flex-grow: 1;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> height: 200px;
<add> flex-grow: 2;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.md
<add>---
<add>id: 587d78ae367417b2b2512afe
<add>title: Use the flex Shorthand Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cbpW2tE'
<add>forumTopicId: 301112
<add>dashedName: use-the-flex-shorthand-property
<add>---
<add>
<add># --description--
<add>
<add>There is a shortcut available to set several flex properties at once. The `flex-grow`, `flex-shrink`, and `flex-basis` properties can all be set together by using the `flex` property.
<add>
<add>For example, `flex: 1 0 10px;` will set the item to `flex-grow: 1;`, `flex-shrink: 0;`, and `flex-basis: 10px;`.
<add>
<add>The default property settings are `flex: 0 1 auto;`.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex` to both `#box-1` and `#box-2`. Give `#box-1` the values so its `flex-grow` is `2`, its `flex-shrink` is `2`, and its `flex-basis` is `150px`. Give `#box-2` the values so its `flex-grow` is `1`, its `flex-shrink` is `1`, and its `flex-basis` is `150px`.
<add>
<add>These values will cause `#box-1` to grow to fill the extra space at twice the rate of `#box-2` when the container is greater than 300px and shrink at twice the rate of `#box-2` when the container is less than 300px. 300px is the combined size of the `flex-basis` values of the two boxes.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `flex` property set to a value of `2 2 150px`.
<add>
<add>```js
<add>assert(
<add> $('#box-1').css('flex-grow') == '2' &&
<add> $('#box-1').css('flex-shrink') == '2' &&
<add> $('#box-1').css('flex-basis') == '150px'
<add>);
<add>```
<add>
<add>The `#box-2` element should have the `flex` property set to a value of `1 1 150px`.
<add>
<add>```js
<add>assert(
<add> $('#box-2').css('flex-grow') == '1' &&
<add> $('#box-2').css('flex-shrink') == '1' &&
<add> $('#box-2').css('flex-basis') == '150px'
<add>);
<add>```
<add>
<add>Your code should use the `flex` property for `#box-1` and `#box-2`.
<add>
<add>```js
<add>assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add>
<add> height: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add>
<add> height: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> flex: 2 2 150px;
<add> height: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> flex: 1 1 150px;
<add> height: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.md
<add>---
<add>id: 587d78ad367417b2b2512afb
<add>title: Use the flex-shrink Property to Shrink Items
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cd3PBfr'
<add>forumTopicId: 301113
<add>dashedName: use-the-flex-shrink-property-to-shrink-items
<add>---
<add>
<add># --description--
<add>
<add>So far, all the properties in the challenges apply to the flex container (the parent of the flex items). However, there are several useful properties for the flex items.
<add>
<add>The first is the `flex-shrink` property. When it's used, it allows an item to shrink if the flex container is too small. Items shrink when the width of the parent container is smaller than the combined widths of all the flex items within it.
<add>
<add>The `flex-shrink` property takes numbers as values. The higher the number, the more it will shrink compared to the other items in the container. For example, if one item has a `flex-shrink` value of `1` and the other has a `flex-shrink` value of `3`, the one with the value of `3` will shrink three times as much as the other.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `flex-shrink` to both `#box-1` and `#box-2`. Give `#box-1` a value of `1` and `#box-2` a value of `2`.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `flex-shrink` property set to a value of `1`.
<add>
<add>```js
<add>assert($('#box-1').css('flex-shrink') == '1');
<add>```
<add>
<add>The `#box-2` element should have the `flex-shrink` property set to a value of `2`.
<add>
<add>```js
<add>assert($('#box-2').css('flex-shrink') == '2');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 100%;
<add> height: 200px;
<add>
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 100%;
<add> height: 200px;
<add>
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 100%;
<add> height: 200px;
<add> flex-shrink: 1;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 100%;
<add> height: 200px;
<add> flex-shrink: 2;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.md
<add>---
<add>id: 587d78ad367417b2b2512afa
<add>title: Use the flex-wrap Property to Wrap a Row or Column
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cQv9ZtG'
<add>forumTopicId: 301114
<add>dashedName: use-the-flex-wrap-property-to-wrap-a-row-or-column
<add>---
<add>
<add># --description--
<add>
<add>CSS flexbox has a feature to split a flex item into multiple rows (or columns). By default, a flex container will fit all flex items together. For example, a row will all be on one line.
<add>
<add>However, using the `flex-wrap` property tells CSS to wrap items. This means extra items move into a new row or column. The break point of where the wrapping happens depends on the size of the items and the size of the container.
<add>
<add>CSS also has options for the direction of the wrap:
<add>
<add><ul><li><code>nowrap</code>: this is the default setting, and does not wrap items.</li><li><code>wrap</code>: wraps items onto multiple lines from top-to-bottom if they are in rows and left-to-right if they are in columns.</li><li><code>wrap-reverse</code>: wraps items onto multiple lines from bottom-to-top if they are in rows and right-to-left if they are in columns.</li></ul>
<add>
<add># --instructions--
<add>
<add>The current layout has too many boxes for one row. Add the CSS property `flex-wrap` to the `#box-container` element, and give it a value of `wrap`.
<add>
<add># --hints--
<add>
<add>The `#box-container` element should have the `flex-wrap` property set to a value of `wrap`.
<add>
<add>```js
<add>assert($('#box-container').css('flex-wrap') == 'wrap');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 100%;
<add>
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 25%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-3 {
<add> background-color: violet;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-4 {
<add> background-color: yellow;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-5 {
<add> background-color: green;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-6 {
<add> background-color: black;
<add> width: 25%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add> <div id="box-3"></div>
<add> <div id="box-4"></div>
<add> <div id="box-5"></div>
<add> <div id="box-6"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> background: gray;
<add> display: flex;
<add> height: 100%;
<add> flex-wrap: wrap;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> width: 25%;
<add> height: 50%;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-3 {
<add> background-color: violet;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-4 {
<add> background-color: yellow;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-5 {
<add> background-color: green;
<add> width: 25%;
<add> height: 50%;
<add> }
<add> #box-6 {
<add> background-color: black;
<add> width: 25%;
<add> height: 50%;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add> <div id="box-3"></div>
<add> <div id="box-4"></div>
<add> <div id="box-5"></div>
<add> <div id="box-6"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.md
<add>---
<add>id: 587d78ac367417b2b2512af7
<add>title: Use the justify-content Property in the Tweet Embed
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/c43GgTa'
<add>forumTopicId: 301115
<add>dashedName: use-the-justify-content-property-in-the-tweet-embed
<add>---
<add>
<add># --description--
<add>
<add>The last challenge showed an example of the `justify-content` property. For the tweet embed, this property can be applied to align the items in the `.profile-name` element.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `justify-content` to the header's `.profile-name` element and set the value to any of the options from the last challenge.
<add>
<add># --hints--
<add>
<add>Your `.follow-btn` should be rendered on the page. Be sure to turn off any extensions such as ad blockers.
<add>
<add>```js
<add>assert($('.follow-btn').length > 0 && $('.follow-btn').css('display') !== 'none');
<add>```
<add>
<add>The `.profile-name` element should have the `justify-content` property set to any of these values: `center`, `flex-start`, `flex-end`, `space-between`, `space-around`, or `space-evenly`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around|space-evenly)\s*;/g
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> flex-direction: column;
<add>
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> body {
<add> font-family: Arial, sans-serif;
<add> }
<add> header, footer {
<add> display: flex;
<add> flex-direction: row;
<add> }
<add> header .profile-thumbnail {
<add> width: 50px;
<add> height: 50px;
<add> border-radius: 4px;
<add> }
<add> header .profile-name {
<add> display: flex;
<add> flex-direction: column;
<add> justify-content: center;
<add> margin-left: 10px;
<add> }
<add> header .follow-btn {
<add> display: flex;
<add> margin: 0 0 0 auto;
<add> }
<add> header .follow-btn button {
<add> border: 0;
<add> border-radius: 3px;
<add> padding: 5px;
<add> }
<add> header h3, header h4 {
<add> display: flex;
<add> margin: 0;
<add> }
<add> #inner p {
<add> margin-bottom: 10px;
<add> font-size: 20px;
<add> }
<add> #inner hr {
<add> margin: 20px 0;
<add> border-style: solid;
<add> opacity: 0.1;
<add> }
<add> footer .stats {
<add> display: flex;
<add> font-size: 15px;
<add> }
<add> footer .stats strong {
<add> font-size: 18px;
<add> }
<add> footer .stats .likes {
<add> margin-left: 10px;
<add> }
<add> footer .cta {
<add> margin-left: auto;
<add> }
<add> footer .cta button {
<add> border: 0;
<add> background: transparent;
<add> }
<add></style>
<add><header>
<add> <img src="https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<add> <div class="profile-name">
<add> <h3>Quincy Larson</h3>
<add> <h4>@ossia</h4>
<add> </div>
<add> <div class="follow-btn">
<add> <button>Follow</button>
<add> </div>
<add></header>
<add><div id="inner">
<add> <p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<add> <span class="date">1:32 PM - 12 Jan 2018</span>
<add> <hr>
<add></div>
<add><footer>
<add> <div class="stats">
<add> <div class="Retweets">
<add> <strong>107</strong> Retweets
<add> </div>
<add> <div class="likes">
<add> <strong>431</strong> Likes
<add> </div>
<add> </div>
<add> <div class="cta">
<add> <button class="share-btn">Share</button>
<add> <button class="retweet-btn">Retweet</button>
<add> <button class="like-btn">Like</button>
<add> </div>
<add></footer>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.md
<add>---
<add>id: 587d78ae367417b2b2512aff
<add>title: Use the order Property to Rearrange Items
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvNAG'
<add>forumTopicId: 301116
<add>dashedName: use-the-order-property-to-rearrange-items
<add>---
<add>
<add># --description--
<add>
<add>The `order` property is used to tell CSS the order of how flex items appear in the flex container. By default, items will appear in the same order they come in the source HTML. The property takes numbers as values, and negative numbers can be used.
<add>
<add># --instructions--
<add>
<add>Add the CSS property `order` to both `#box-1` and `#box-2`. Give `#box-1` a value of `2` and give `#box-2` a value of `1`.
<add>
<add># --hints--
<add>
<add>The `#box-1` element should have the `order` property set to a value of `2`.
<add>
<add>```js
<add>assert($('#box-1').css('order') == '2');
<add>```
<add>
<add>The `#box-2` element should have the `order` property set to a value of `1`.
<add>
<add>```js
<add>assert($('#box-2').css('order') == '1');
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add>
<add> height: 200px;
<add> width: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add>
<add> height: 200px;
<add> width: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> #box-container {
<add> display: flex;
<add> height: 500px;
<add> }
<add> #box-1 {
<add> background-color: dodgerblue;
<add> order: 2;
<add> height: 200px;
<add> width: 200px;
<add> }
<add>
<add> #box-2 {
<add> background-color: orangered;
<add> order: 1;
<add> height: 200px;
<add> width: 200px;
<add> }
<add></style>
<add>
<add><div id="box-container">
<add> <div id="box-1"></div>
<add> <div id="box-2"></div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.md
<add>---
<add>id: 5a9036d038fddaf9a66b5d32
<add>title: Add Columns with grid-template-columns
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/c7NzDHv'
<add>forumTopicId: 301117
<add>dashedName: add-columns-with-grid-template-columns
<add>---
<add>
<add># --description--
<add>
<add>Simply creating a grid element doesn't get you very far. You need to define the structure of the grid as well. To add some columns to the grid, use the `grid-template-columns` property on a grid container as demonstrated below:
<add>
<add>```css
<add>.container {
<add> display: grid;
<add> grid-template-columns: 50px 50px;
<add>}
<add>```
<add>
<add>This will give your grid two columns that are each 50px wide. The number of parameters given to the `grid-template-columns` property indicates the number of columns in the grid, and the value of each parameter indicates the width of each column.
<add>
<add># --instructions--
<add>
<add>Give the grid container three columns that are each `100px` wide.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-columns` property with three units of `100px`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-columns: 100px 100px 100px;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.md
<add>---
<add>id: 5a9036ee38fddaf9a66b5d37
<add>title: Add Gaps Faster with grid-gap
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/ca2qVtv'
<add>forumTopicId: 301118
<add>dashedName: add-gaps-faster-with-grid-gap
<add>---
<add>
<add># --description--
<add>
<add>`grid-gap` is a shorthand property for `grid-row-gap` and `grid-column-gap` from the previous two challenges that's more convenient to use. If `grid-gap` has one value, it will create a gap between all rows and columns. However, if there are two values, it will use the first one to set the gap between the rows and the second value for the columns.
<add>
<add># --instructions--
<add>
<add>Use `grid-gap` to introduce a `10px` gap between the rows and `20px` gap between the columns.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-gap` property that introduces a `10px` gap between the rows and a `20px` gap between the columns.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-gap: 10px 20px;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.md
<add>---
<add>id: 5a9036e138fddaf9a66b5d33
<add>title: Add Rows with grid-template-rows
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cbp9Pua'
<add>forumTopicId: 301119
<add>dashedName: add-rows-with-grid-template-rows
<add>---
<add>
<add># --description--
<add>
<add>The grid you created in the last challenge will set the number of rows automatically. To adjust the rows manually, use the `grid-template-rows` property in the same way you used `grid-template-columns` in the previous challenge.
<add>
<add># --instructions--
<add>
<add>Add two rows to the grid that are `50px` tall each.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-rows` property with two units of `50px`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 100px 100px 100px;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-rows: 50px 50px;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.md
<add>---
<add>id: 5a90376038fddaf9a66b5d3c
<add>title: Align All Items Horizontally using justify-items
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cJbpECn'
<add>forumTopicId: 301120
<add>dashedName: align-all-items-horizontally-using-justify-items
<add>---
<add>
<add># --description--
<add>
<add>Sometimes you want all the items in your CSS Grid to share the same alignment. You can use the previously learned properties and align them individually, or you can align them all at once horizontally by using `justify-items` on your grid container. This property can accept all the same values you learned about in the previous two challenges, the difference being that it will move **all** the items in our grid to the desired alignment.
<add>
<add># --instructions--
<add>
<add>Use this property to center all our items horizontally.
<add>
<add># --hints--
<add>
<add>`container` class should have a `justify-items` property that has the value of `center`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {justify-items: center;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.md
<add>---
<add>id: 5a94fdf869fb03452672e45b
<add>title: Align All Items Vertically using align-items
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/ckzPeUv'
<add>forumTopicId: 301121
<add>dashedName: align-all-items-vertically-using-align-items
<add>---
<add>
<add># --description--
<add>
<add>Using the `align-items` property on a grid container will set the vertical alignment for all the items in our grid.
<add>
<add># --instructions--
<add>
<add>Use it now to move all the items to the end of each cell.
<add>
<add># --hints--
<add>
<add>`container` class should have a `align-items` property that has the value of `end`.
<add>
<add>```js
<add>assert(
<add> code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {align-items: end;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.md
<add>---
<add>id: 5a90374338fddaf9a66b5d3a
<add>title: Align an Item Horizontally using justify-self
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cJbpKHq'
<add>forumTopicId: 301122
<add>dashedName: align-an-item-horizontally-using-justify-self
<add>---
<add>
<add># --description--
<add>
<add>In CSS Grid, the content of each item is located in a box which is referred to as a <dfn>cell</dfn>. You can align the content's position within its cell horizontally using the `justify-self` property on a grid item. By default, this property has a value of `stretch`, which will make the content fill the whole width of the cell. This CSS Grid property accepts other values as well:
<add>
<add>`start`: aligns the content at the left of the cell,
<add>
<add>`center`: aligns the content in the center of the cell,
<add>
<add>`end`: aligns the content at the right of the cell.
<add>
<add># --instructions--
<add>
<add>Use the `justify-self` property to center the item with the class `item2`.
<add>
<add># --hints--
<add>
<add>`item2` class should have a `justify-self` property that has the value of `center`.
<add>
<add>```js
<add>assert(
<add> code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background: LightSkyBlue;}
<add>
<add> .item2 {
<add> background: LightSalmon;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.item2 {justify-self: center;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.md
<add>---
<add>id: 5a90375238fddaf9a66b5d3b
<add>title: Align an Item Vertically using align-self
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cmzd4fz'
<add>forumTopicId: 301123
<add>dashedName: align-an-item-vertically-using-align-self
<add>---
<add>
<add># --description--
<add>
<add>Just as you can align an item horizontally, there's a way to align an item vertically as well. To do this, you use the `align-self` property on an item. This property accepts all of the same values as `justify-self` from the last challenge.
<add>
<add># --instructions--
<add>
<add>Align the item with the class `item3` vertically at the `end`.
<add>
<add># --hints--
<add>
<add>`item3` class should have a `align-self` property that has the value of `end`.
<add>
<add>```js
<add>assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add>
<add> .item3 {
<add> background: PaleTurquoise;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.item3 {align-self: end;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.md
<add>---
<add>id: 5a9036ee38fddaf9a66b5d35
<add>title: Create a Column Gap Using grid-column-gap
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cVZ8vfD'
<add>forumTopicId: 301124
<add>dashedName: create-a-column-gap-using-grid-column-gap
<add>---
<add>
<add># --description--
<add>
<add>So far in the grids you have created, the columns have all been tight up against each other. Sometimes you want a gap in between the columns. To add a gap between the columns, use the `grid-column-gap` property like this:
<add>
<add>```css
<add>grid-column-gap: 10px;
<add>```
<add>
<add>This creates 10px of empty space between all of our columns.
<add>
<add># --instructions--
<add>
<add>Give the columns in the grid a `20px` gap.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-column-gap` property that has the value of `20px`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-column-gap: 20px;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.md
<add>---
<add>id: 5a9036ee38fddaf9a66b5d36
<add>title: Create a Row Gap using grid-row-gap
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cPbJ2Cv'
<add>forumTopicId: 301125
<add>dashedName: create-a-row-gap-using-grid-row-gap
<add>---
<add>
<add># --description--
<add>
<add>You can add a gap in between the rows of a grid using `grid-row-gap` in the same way that you added a gap in between columns in the previous challenge.
<add>
<add># --instructions--
<add>
<add>Create a gap for the rows that is `5px` tall.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-row-gap` property that has the value of `5px`.
<add>
<add>```js
<add>assert(
<add> code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-row-gap: 5px;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.md
<add>---
<add>id: 5a94fe5469fb03452672e461
<add>title: Create Flexible Layouts Using auto-fill
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cmzdycW'
<add>forumTopicId: 301126
<add>dashedName: create-flexible-layouts-using-auto-fill
<add>---
<add>
<add># --description--
<add>
<add>The repeat function comes with an option called <dfn>auto-fill</dfn>. This allows you to automatically insert as many rows or columns of your desired size as possible depending on the size of the container. You can create flexible layouts when combining `auto-fill` with `minmax`, like this:
<add>
<add>```css
<add>repeat(auto-fill, minmax(60px, 1fr));
<add>```
<add>
<add>When the container changes size, this setup keeps inserting 60px columns and stretching them until it can insert another one. **Note:** If your container can't fit all your items on one row, it will move them down to a new one.
<add>
<add># --instructions--
<add>
<add>In the first grid, use `auto-fill` with `repeat` to fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`. Then resize the preview to see auto-fill in action.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-columns` property with `repeat` and `auto-fill` that will fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: repeat(3, minmax(60px, 1fr));
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add>
<add> .container2 {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: Silver;
<add> display: grid;
<add> grid-template-columns: repeat(3, minmax(60px, 1fr));
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add><div class="container2">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add>
<add> .container2 {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: Silver;
<add> display: grid;
<add> grid-template-columns: repeat(3, minmax(60px, 1fr));
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add><div class="container2">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.md
<add>---
<add>id: 5a94fe6269fb03452672e462
<add>title: Create Flexible Layouts Using auto-fit
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/c3dPph8'
<add>forumTopicId: 301127
<add>dashedName: create-flexible-layouts-using-auto-fit
<add>---
<add>
<add># --description--
<add>
<add>`auto-fit` works almost identically to `auto-fill`. The only difference is that when the container's size exceeds the size of all the items combined, `auto-fill` keeps inserting empty rows or columns and pushes your items to the side, while `auto-fit` collapses those empty rows or columns and stretches your items to fit the size of the container.
<add>
<add>**Note:** If your container can't fit all your items on one row, it will move them down to a new one.
<add>
<add># --instructions--
<add>
<add>In the second grid, use `auto-fit` with `repeat` to fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`. Then resize the preview to see the difference.
<add>
<add># --hints--
<add>
<add>`container2` class should have a `grid-template-columns` property with `repeat` and `auto-fit` that will fill the grid with columns that have a minimum width of `60px` and a maximum of `1fr`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container2\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add>
<add> .container2 {
<add> font-size: 40px;
<add> min-height: 100px;
<add> width: 100%;
<add> background: Silver;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: repeat(3, minmax(60px, 1fr));
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add><div class="container2">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-columns: repeat( auto-fill, minmax(60px, 1fr));} .container2 {grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-grids-within-grids.md
<add>---
<add>id: 5a94fe8569fb03452672e464
<add>title: Create Grids within Grids
<add>challengeType: 0
<add>forumTopicId: 301128
<add>dashedName: create-grids-within-grids
<add>---
<add>
<add># --description--
<add>
<add>Turning an element into a grid only affects the behavior of its direct descendants. So by turning a direct descendant into a grid, you have a grid within a grid.
<add>
<add>For example, by setting the `display` and `grid-template-columns` properties of the element with the `item3` class, you create a grid within your grid.
<add>
<add># --instructions--
<add>
<add>Turn the element with the `item3` class into a grid with two columns with a width of `auto` and `1fr` using `display` and `grid-template-columns`.
<add>
<add># --hints--
<add>
<add>`item3` class should have a `grid-template-columns` property with `auto` and `1fr` as values.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add>`item3` class should have a `display` property with the value of `grid`.
<add>
<add>```js
<add>assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .container {
<add> font-size: 1.5em;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: auto 1fr;
<add> grid-template-rows: auto 1fr auto;
<add> grid-gap: 10px;
<add> grid-template-areas:
<add> "advert header"
<add> "advert content"
<add> "advert footer";
<add> }
<add> .item1 {
<add> background: LightSkyBlue;
<add> grid-area: header;
<add> }
<add>
<add> .item2 {
<add> background: LightSalmon;
<add> grid-area: advert;
<add> }
<add>
<add> .item3 {
<add> background: PaleTurquoise;
<add> grid-area: content;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .item4 {
<add> background: lightpink;
<add> grid-area: footer;
<add> }
<add>
<add> .itemOne {
<add> background: PaleGreen;
<add> }
<add>
<add> .itemTwo {
<add> background: BlanchedAlmond;
<add> }
<add>
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">header</div>
<add> <div class="item2">advert</div>
<add> <div class="item3">
<add> <div class="itemOne">paragraph1</div>
<add> <div class="itemTwo">paragraph2</div>
<add> </div>
<add> <div class="item4">footer</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.item3 {grid-template-columns: auto 1fr; display: grid;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/create-your-first-css-grid.md
<add>---
<add>id: 5a858944d96184f06fd60d61
<add>title: Create Your First CSS Grid
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cqwREC4'
<add>forumTopicId: 301129
<add>dashedName: create-your-first-css-grid
<add>---
<add>
<add># --description--
<add>
<add>Turn any HTML element into a grid container by setting its `display` property to `grid`. This gives you the ability to use all the other properties associated with CSS Grid.
<add>
<add>**Note:** In CSS Grid, the parent element is referred to as the <dfn>container</dfn> and its children are called <dfn>items</dfn>.
<add>
<add># --instructions--
<add>
<add>Change the display of the div with the `container` class to `grid`.
<add>
<add># --hints--
<add>
<add>`container` class should have a `display` property with a value of `grid`.
<add>
<add>```js
<add>assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> width: 100%;
<add> background: LightGray;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {display: grid;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.md
<add>---
<add>id: 5a94fe0569fb03452672e45c
<add>title: Divide the Grid Into an Area Template
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cLLpGAy'
<add>forumTopicId: 301130
<add>dashedName: divide-the-grid-into-an-area-template
<add>---
<add>
<add># --description--
<add>
<add>You can group cells of your grid together into an <dfn>area</dfn> and give the area a custom name. Do this by using `grid-template-areas` on the container like this:
<add>
<add>```css
<add>grid-template-areas:
<add> "header header header"
<add> "advert content content"
<add> "footer footer footer";
<add>```
<add>
<add>The code above merges the top three cells together into an area named `header`, the bottom three cells into a `footer` area, and it makes two areas in the middle row; `advert` and `content`. **Note:** Every word in the code represents a cell and every pair of quotation marks represent a row. In addition to custom labels, you can use a period (`.`) to designate an empty cell in the grid.
<add>
<add># --instructions--
<add>
<add>Place the area template so that the cell labeled `advert` becomes an empty cell.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-areas` property similar to the preview but with`.` instead of the `advert` area.
<add>
<add>```js
<add>assert(
<add> __helpers
<add> .removeCssComments(code)
<add> .match(
<add> /.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> grid-template-areas:
<add> /* Only change code below this line */
<add> "header header header"
<add> "advert content content"
<add> "footer footer footer";
<add> /* Only change code above this line */
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add>
<add> grid-template-areas:
<add> "header header header"
<add> ". content content"
<add> "footer footer footer";
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.md
<add>---
<add>id: 5a94fe4469fb03452672e460
<add>title: Limit Item Size Using the minmax Function
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cD97RTv'
<add>forumTopicId: 301131
<add>dashedName: limit-item-size-using-the-minmax-function
<add>---
<add>
<add># --description--
<add>
<add>There's another built-in function to use with `grid-template-columns` and `grid-template-rows` called `minmax`. It's used to limit the size of items when the grid container changes size. To do this you need to specify the acceptable size range for your item. Here is an example:
<add>
<add>```css
<add>grid-template-columns: 100px minmax(50px, 200px);
<add>```
<add>
<add>In the code above, `grid-template-columns` is set to create two columns; the first is 100px wide, and the second has the minimum width of 50px and the maximum width of 200px.
<add>
<add># --instructions--
<add>
<add>Using the `minmax` function, replace the `1fr` in the `repeat` function with a column size that has the minimum width of `90px` and the maximum width of `1fr`, and resize the preview panel to see the effect.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-columns` property that is set to repeat 3 columns with the minimum width of `90px` and maximum width of `1fr`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: repeat(3, 1fr);
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-columns: repeat(3, minmax(90px, 1fr));}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.md
<add>---
<add>id: 5a94fe1369fb03452672e45d
<add>title: Place Items in Grid Areas Using the grid-area Property
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cRrqmtV'
<add>forumTopicId: 301132
<add>dashedName: place-items-in-grid-areas-using-the-grid-area-property
<add>---
<add>
<add># --description--
<add>
<add>After creating an area template for your grid container, as shown in the previous challenge, you can place an item in your custom area by referencing the name you gave it. To do this, you use the `grid-area` property on an item like this:
<add>
<add>```css
<add>.item1 {
<add> grid-area: header;
<add>}
<add>```
<add>
<add>This lets the grid know that you want the `item1` class to go in the area named `header`. In this case, the item will use the entire top row because that whole row is named as the header area.
<add>
<add># --instructions--
<add>
<add>Place an element with the `item5` class in the `footer` area using the `grid-area` property.
<add>
<add># --hints--
<add>
<add>`item5` class should have a `grid-area` property that has the value of `footer`.
<add>
<add>```js
<add>assert(
<add> __helpers
<add> .removeCssComments(code)
<add> .match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi)
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> grid-template-areas:
<add> "header header header"
<add> "advert content content"
<add> "footer footer footer";
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.item5 {grid-area: footer;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.md
<add>---
<add>id: 5a94fe3669fb03452672e45f
<add>title: Reduce Repetition Using the repeat Function
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cQvqyHR'
<add>forumTopicId: 301133
<add>dashedName: reduce-repetition-using-the-repeat-function
<add>---
<add>
<add># --description--
<add>
<add>When you used `grid-template-columns` and `grid-template-rows` to define the structure of a grid, you entered a value for each row or column you created.
<add>
<add>Let's say you want a grid with 100 rows of the same height. It isn't very practical to insert 100 values individually. Fortunately, there's a better way - by using the `repeat` function to specify the number of times you want your column or row to be repeated, followed by a comma and the value you want to repeat.
<add>
<add>Here's an example that would create the 100 row grid, each row at 50px tall.
<add>
<add>```css
<add>grid-template-rows: repeat(100, 50px);
<add>```
<add>
<add>You can also repeat multiple values with the repeat function and insert the function amongst other values when defining a grid structure. Here's what that looks like:
<add>
<add>```css
<add>grid-template-columns: repeat(2, 1fr 50px) 20px;
<add>```
<add>
<add>This translates to:
<add>
<add>```css
<add>grid-template-columns: 1fr 50px 1fr 50px 20px;
<add>```
<add>
<add>**Note:** The `1fr 50px` is repeated twice followed by 20px.
<add>
<add># --instructions--
<add>
<add>Use `repeat` to remove repetition from the `grid-template-columns` property.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-columns` property that is set to repeat 3 columns with the width of `1fr`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add> .item5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: 1fr 1fr 1fr;
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-columns: repeat(3, 1fr);}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.md
<add>---
<add>id: 5a9036ee38fddaf9a66b5d34
<add>title: Use CSS Grid units to Change the Size of Columns and Rows
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cvE8phd'
<add>forumTopicId: 301134
<add>dashedName: use-css-grid-units-to-change-the-size-of-columns-and-rows
<add>---
<add>
<add># --description--
<add>
<add>You can use absolute and relative units like `px` and `em` in CSS Grid to define the size of rows and columns. You can use these as well:
<add>
<add>`fr`: sets the column or row to a fraction of the available space,
<add>
<add>`auto`: sets the column or row to the width or height of its content automatically,
<add>
<add>`%`: adjusts the column or row to the percent width of its container.
<add>
<add>Here's the code that generates the output in the preview:
<add>
<add>```css
<add>grid-template-columns: auto 50px 10% 2fr 1fr;
<add>```
<add>
<add>This snippet creates five columns. The first column is as wide as its content, the second column is 50px, the third column is 10% of its container, and for the last two columns; the remaining space is divided into three sections, two are allocated for the fourth column, and one for the fifth.
<add>
<add># --instructions--
<add>
<add>Make a grid with three columns whose widths are as follows: 1fr, 100px, and 2fr.
<add>
<add># --hints--
<add>
<add>`container` class should have a `grid-template-columns` property that has three columns with the following widths: `1fr, 100px, and 2fr`.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?1fr\s*?100px\s*?2fr\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .d1{background:LightSkyBlue;}
<add> .d2{background:LightSalmon;}
<add> .d3{background:PaleTurquoise;}
<add> .d4{background:LightPink;}
<add> .d5{background:PaleGreen;}
<add>
<add> .container {
<add> font-size: 40px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> /* Only change code below this line */
<add>
<add> grid-template-columns: auto 50px 10% 2fr 1fr;
<add>
<add> /* Only change code above this line */
<add> grid-template-rows: 50px 50px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="d1">1</div>
<add> <div class="d2">2</div>
<add> <div class="d3">3</div>
<add> <div class="d4">4</div>
<add> <div class="d5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.container {grid-template-columns: 1fr 100px 2fr;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.md
<add>---
<add>id: 5a94fe2669fb03452672e45e
<add>title: Use grid-area Without Creating an Areas Template
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/c6N7VhK'
<add>forumTopicId: 301135
<add>dashedName: use-grid-area-without-creating-an-areas-template
<add>---
<add>
<add># --description--
<add>
<add>The `grid-area` property you learned in the last challenge can be used in another way. If your grid doesn't have an areas template to reference, you can create an area on the fly for an item to be placed like this:
<add>
<add>```css
<add>item1 { grid-area: 1/1/2/4; }
<add>```
<add>
<add>This is using the line numbers you learned about earlier to define where the area for this item will be. The numbers in the example above represent these values:
<add>
<add>```css
<add>grid-area: horizontal line to start at / vertical line to start at / horizontal line to end at / vertical line to end at;
<add>```
<add>
<add>So the item in the example will consume the rows between lines 1 and 2, and the columns between lines 1 and 4.
<add>
<add># --instructions--
<add>
<add>Using the `grid-area` property, place the element with `item5` class between the third and fourth horizontal lines and between the first and fourth vertical lines.
<add>
<add># --hints--
<add>
<add>The `item5` class should have a `grid-area` property to make it fill the whole area between the third and fourth horizontal lines, and first and fourth vertical lines.
<add>
<add>```js
<add>assert(
<add> code.match(
<add> /.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>.item5 {grid-area: 3/1/4/4;}</style>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.md
<add>---
<add>id: 5a90372638fddaf9a66b5d38
<add>title: Use grid-column to Control Spacing
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cnzkDSr'
<add>forumTopicId: 301136
<add>dashedName: use-grid-column-to-control-spacing
<add>---
<add>
<add># --description--
<add>
<add>Up to this point, all the properties that have been discussed are for grid containers. The `grid-column` property is the first one for use on the grid items themselves.
<add>
<add>The hypothetical horizontal and vertical lines that create the grid are referred to as <dfn>lines</dfn>. These lines are numbered starting with 1 at the top left corner of the grid and move right for columns and down for rows, counting upward.
<add>
<add>This is what the lines look like for a 3x3 grid:
<add>
<add><div style='position:relative;margin:auto;background:Gainsboro;display:block;margin-top:100px;margin-bottom:50px;width:200px;height:200px;'><p style='left:25%;top:-30%;font-size:130%;position:absolute;color:RoyalBlue;'>column lines</p><p style='left:0%;top:-15%;font-size:130%;position:absolute;color:RoyalBlue;'>1</p><p style='left:30%;top:-15%;font-size:130%;position:absolute;color:RoyalBlue;'>2</p><p style='left:63%;top:-15%;font-size:130%;position:absolute;color:RoyalBlue;'>3</p><p style='left:95%;top:-15%;font-size:130%;position:absolute;color:RoyalBlue;'>4</p><p style='left:-40%;top:45%;font-size:130%;transform:rotateZ(-90deg);position:absolute;'>row lines</p><p style='left:-10%;top:-10%;font-size:130%;position:absolute;'>1</p><p style='left:-10%;top:21%;font-size:130%;position:absolute;'>2</p><p style='left:-10%;top:53%;font-size:130%;position:absolute;'>3</p><p style='left:-10%;top:85%;font-size:130%;position:absolute;'>4</p><div style='left:0%;top:0%;width:5%;height:100%;background:RoyalBlue;position:absolute;'></div><div style='left:31%;top:0%;width:5%;height:100%;background:RoyalBlue;position:absolute;'></div><div style='left:63%;top:0%;width:5%;height:100%;background:RoyalBlue;position:absolute;'></div><div style='left:95%;top:0%;width:5%;height:100%;background:RoyalBlue;position:absolute;'></div><div style='left:0%;top:0%;width:100%;height:5%;background:black;position:absolute;'></div><div style='left:0%;top:31%;width:100%;height:5%;background:black;position:absolute;'></div><div style='left:0%;top:63%;width:100%;height:5%;background:black;position:absolute;'></div><div style='left:0%;top:95%;width:100%;height:5%;background:black;position:absolute;'></div></div>
<add>
<add>To control the number of columns an item will consume, you can use the `grid-column` property in conjunction with the line numbers you want the item to start and stop at.
<add>
<add>Here's an example:
<add>
<add>```css
<add>grid-column: 1 / 3;
<add>```
<add>
<add>This will make the item start at the first vertical line of the grid on the left and span to the 3rd line of the grid, consuming two columns.
<add>
<add># --instructions--
<add>
<add>Make the item with the class `item5` consume the last two columns of the grid.
<add>
<add># --hints--
<add>
<add>`item5` class should have a `grid-column` property.
<add>
<add>```js
<add>assert(
<add> __helpers
<add> .removeWhiteSpace($('style').text())
<add> .match(/\.item5{.*grid-column:.*}/g)
<add>);
<add>```
<add>
<add>`item5` class should have a `grid-column` property which results in it consuming the last two columns of the grid.
<add>
<add>```js
<add>const colStart = getComputedStyle($('.item5')[0]).gridColumnStart;
<add>const colEnd = getComputedStyle($('.item5')[0]).gridColumnEnd;
<add>const result = colStart.toString() + colEnd.toString();
<add>const correctResults = [
<add> '24',
<add> '2-1',
<add> '2span 2',
<add> '2span2',
<add> 'span 2-1',
<add> '-12',
<add> 'span 2span 2',
<add> 'span 2auto',
<add> 'autospan 2'
<add>];
<add>assert(correctResults.includes(result));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> /* Only change code below this line */
<add>
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> grid-column: 2 / 4;
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.md
<add>---
<add>id: 5a90373638fddaf9a66b5d39
<add>title: Use grid-row to Control Spacing
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/c9WBLU4'
<add>forumTopicId: 301137
<add>dashedName: use-grid-row-to-control-spacing
<add>---
<add>
<add># --description--
<add>
<add>Of course, you can make items consume multiple rows just like you can with columns. You define the horizontal lines you want an item to start and stop at using the `grid-row` property on a grid item.
<add>
<add># --instructions--
<add>
<add>Make the element with the `item5` class consume the last two rows.
<add>
<add># --hints--
<add>
<add>`item5` class should have a `grid-row` property.
<add>
<add>```js
<add>assert(
<add> __helpers.removeWhiteSpace($('style').text()).match(/\.item5{.*grid-row:.*}/g)
<add>);
<add>```
<add>
<add>`item5` class should have a `grid-row` property which results in it consuming the last two rows of the grid.
<add>
<add>```js
<add>const rowStart = getComputedStyle($('.item5')[0]).gridRowStart;
<add>const rowEnd = getComputedStyle($('.item5')[0]).gridRowEnd;
<add>const result = rowStart.toString() + rowEnd.toString();
<add>const correctResults = [
<add> '24',
<add> '2-1',
<add> '2span 2',
<add> '2span2',
<add> 'span 2-1',
<add> '-12',
<add> 'span 2span 2',
<add> 'span 2auto',
<add> 'autospan 2'
<add>];
<add>assert(correctResults.includes(result));
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> grid-column: 2 / 4;
<add> /* Only change code below this line */
<add>
<add> /* Only change code above this line */
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .item1{background:LightSkyBlue;}
<add> .item2{background:LightSalmon;}
<add> .item3{background:PaleTurquoise;}
<add> .item4{background:LightPink;}
<add>
<add> .item5 {
<add> background: PaleGreen;
<add> grid-column: 2 / 4;
<add> grid-row: 2 / 4;
<add> }
<add>
<add> .container {
<add> font-size: 40px;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr 1fr 1fr;
<add> grid-template-rows: 1fr 1fr 1fr;
<add> grid-gap: 10px;
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">1</div>
<add> <div class="item2">2</div>
<add> <div class="item3">3</div>
<add> <div class="item4">4</div>
<add> <div class="item5">5</div>
<add></div>
<add>```
<ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.md
<add>---
<add>id: 5a94fe7769fb03452672e463
<add>title: Use Media Queries to Create Responsive Layouts
<add>challengeType: 0
<add>videoUrl: 'https://scrimba.com/p/pByETK/cMbqeHk'
<add>forumTopicId: 301138
<add>dashedName: use-media-queries-to-create-responsive-layouts
<add>---
<add>
<add># --description--
<add>
<add>CSS Grid can be an easy way to make your site more responsive by using media queries to rearrange grid areas, change dimensions of a grid, and rearrange the placement of items.
<add>
<add>In the preview, when the viewport width is 300px or more, the number of columns changes from 1 to 2. The advertisement area then occupies the left column completely.
<add>
<add># --instructions--
<add>
<add>When the viewport width is `400px` or more, make the header area occupy the top row completely and the footer area occupy the bottom row completely.
<add>
<add># --hints--
<add>
<add>When the viewport is `400px` or more, `container` class should have a `grid-template-areas` property in which the header and footer areas occupy the top and bottom rows respectively and advert and content occupy the left and right columns of the middle row.
<add>
<add>```js
<add>assert(
<add> __helpers
<add> .removeCssComments(code)
<add> .match(
<add> /@media\s*?\(\s*?min-width\s*?:\s*?400px\s*?\)[\s\S]*.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?"\s*?"\s*?advert\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi
<add> )
<add>);
<add>```
<add>
<add># --seed--
<add>
<add>## --seed-contents--
<add>
<add>```html
<add><style>
<add> .item1 {
<add> background: LightSkyBlue;
<add> grid-area: header;
<add> }
<add>
<add> .item2 {
<add> background: LightSalmon;
<add> grid-area: advert;
<add> }
<add>
<add> .item3 {
<add> background: PaleTurquoise;
<add> grid-area: content;
<add> }
<add>
<add> .item4 {
<add> background: lightpink;
<add> grid-area: footer;
<add> }
<add>
<add> .container {
<add> font-size: 1.5em;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr;
<add> grid-template-rows: 50px auto 1fr auto;
<add> grid-gap: 10px;
<add> grid-template-areas:
<add> "header"
<add> "advert"
<add> "content"
<add> "footer";
<add> }
<add>
<add> @media (min-width: 300px){
<add> .container{
<add> grid-template-columns: auto 1fr;
<add> grid-template-rows: auto 1fr auto;
<add> grid-template-areas:
<add> "advert header"
<add> "advert content"
<add> "advert footer";
<add> }
<add> }
<add>
<add> @media (min-width: 400px){
<add> .container{
<add> grid-template-areas:
<add> /* Only change code below this line */
<add> "advert header"
<add> "advert content"
<add> "advert footer";
<add> /* Only change code above this line */
<add> }
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">header</div>
<add> <div class="item2">advert</div>
<add> <div class="item3">content</div>
<add> <div class="item4">footer</div>
<add></div>
<add>```
<add>
<add># --solutions--
<add>
<add>```html
<add><style>
<add> .item1 {
<add> background: LightSkyBlue;
<add> grid-area: header;
<add> }
<add>
<add> .item2 {
<add> background: LightSalmon;
<add> grid-area: advert;
<add> }
<add>
<add> .item3 {
<add> background: PaleTurquoise;
<add> grid-area: content;
<add> }
<add>
<add> .item4 {
<add> background: lightpink;
<add> grid-area: footer;
<add> }
<add>
<add> .container {
<add> font-size: 1.5em;
<add> min-height: 300px;
<add> width: 100%;
<add> background: LightGray;
<add> display: grid;
<add> grid-template-columns: 1fr;
<add> grid-template-rows: 50px auto 1fr auto;
<add> grid-gap: 10px;
<add> grid-template-areas:
<add> "header"
<add> "advert"
<add> "content"
<add> "footer";
<add> }
<add>
<add> @media (min-width: 300px){
<add> .container{
<add> grid-template-columns: auto 1fr;
<add> grid-template-rows: auto 1fr auto;
<add> grid-template-areas:
<add> "advert header"
<add> "advert content"
<add> "advert footer";
<add> }
<add> }
<add>
<add> @media (min-width: 400px){
<add> .container{
<add> grid-template-areas:
<add> "header header"
<add> "advert content"
<add> "footer footer";
<add> }
<add> }
<add></style>
<add>
<add><div class="container">
<add> <div class="item1">header</div>
<add> <div class="item2">advert</div>
<add> <div class="item3">content</div>
<add> <div class="item4">footer</div>
<add></div>
<add>``` | 134 |
Java | Java | fix a small typo in single.delay | 84d333e07459d8a786f8a549c0b1f4cd69a8f532 | <ide><path>src/main/java/io/reactivex/Single.java
<ide> public final Single<T> delay(long time, TimeUnit unit) {
<ide> *
<ide> * @param time the time amount to delay the emission of the success signal
<ide> * @param unit the time unit
<del> * @param scheduler the target scheduler to use fro the non-blocking wait and emission
<add> * @param scheduler the target scheduler to use for the non-blocking wait and emission
<ide> * @return the new Single instance
<ide> * @since 2.0
<ide> */ | 1 |
PHP | PHP | add allowdynamicproperties attribute to controller | b73cdaf7505083121e7263e6bfd1fa73c2a1817a | <ide><path>src/Controller/Controller.php
<ide> * @property \Cake\Controller\Component\AuthComponent $Auth
<ide> * @link https://book.cakephp.org/4/en/controllers.html
<ide> */
<add>#[\AllowDynamicProperties]
<ide> class Controller implements EventListenerInterface, EventDispatcherInterface
<ide> {
<ide> use EventDispatcherTrait; | 1 |
Go | Go | remove job image_tarlayer | ba0017595ed9ac30273832b93365b0cb1cf60c05 | <ide><path>graph/export.go
<ide> func (s *TagStore) exportImage(eng *engine.Engine, name, tempdir string) error {
<ide> if err != nil {
<ide> return err
<ide> }
<del> job = eng.Job("image_tarlayer", n)
<del> job.Stdout.Add(fsTar)
<del> if err := job.Run(); err != nil {
<add> if err := s.ImageTarLayer(n, fsTar); err != nil {
<ide> return err
<ide> }
<ide>
<ide><path>graph/service.go
<ide> import (
<ide>
<ide> func (s *TagStore) Install(eng *engine.Engine) error {
<ide> for name, handler := range map[string]engine.Handler{
<del> "image_set": s.CmdSet,
<del> "image_get": s.CmdGet,
<del> "image_inspect": s.CmdLookup,
<del> "image_tarlayer": s.CmdTarLayer,
<del> "image_export": s.CmdImageExport,
<del> "viz": s.CmdViz,
<del> "load": s.CmdLoad,
<del> "push": s.CmdPush,
<add> "image_set": s.CmdSet,
<add> "image_get": s.CmdGet,
<add> "image_inspect": s.CmdLookup,
<add> "image_export": s.CmdImageExport,
<add> "viz": s.CmdViz,
<add> "load": s.CmdLoad,
<add> "push": s.CmdPush,
<ide> } {
<ide> if err := eng.Register(name, handler); err != nil {
<ide> return fmt.Errorf("Could not register %q: %v", name, err)
<ide> func (s *TagStore) CmdLookup(job *engine.Job) error {
<ide> return fmt.Errorf("No such image: %s", name)
<ide> }
<ide>
<del>// CmdTarLayer return the tarLayer of the image
<del>func (s *TagStore) CmdTarLayer(job *engine.Job) error {
<del> if len(job.Args) != 1 {
<del> return fmt.Errorf("usage: %s NAME", job.Name)
<del> }
<del> name := job.Args[0]
<add>// ImageTarLayer return the tarLayer of the image
<add>func (s *TagStore) ImageTarLayer(name string, dest io.Writer) error {
<ide> if image, err := s.LookupImage(name); err == nil && image != nil {
<ide> fs, err := image.TarLayer()
<ide> if err != nil {
<ide> return err
<ide> }
<ide> defer fs.Close()
<ide>
<del> written, err := io.Copy(job.Stdout, fs)
<add> written, err := io.Copy(dest, fs)
<ide> if err != nil {
<ide> return err
<ide> } | 2 |
Python | Python | fix gridspot driver | 0bfe15b2fd03d9067e521c330e2a7cde63de6e2e | <ide><path>libcloud/test/compute/test_gridspot.py
<ide> class GridspotTest(unittest.TestCase, TestCaseMixin):
<ide>
<ide> def setUp(self):
<del> GridspotNodeDriver.conectionCls.conn_class = GridspotMockHttp
<add> GridspotNodeDriver.connectionCls.conn_class = GridspotMockHttp
<ide> GridspotMockHttp.type = None
<ide> self.driver = GridspotNodeDriver(*GRIDSPOT_PARAMS)
<ide> | 1 |
PHP | PHP | remove useless getter / setter | 9b56f12f6c1541ed19f89cfd0beb949eb3dd77c0 | <ide><path>src/Illuminate/Queue/DatabaseQueue.php
<ide> public function getDatabase()
<ide> {
<ide> return $this->database;
<ide> }
<del>
<del> /**
<del> * Get the expiration time in seconds.
<del> *
<del> * @return int|null
<del> */
<del> public function getExpire()
<del> {
<del> return $this->expire;
<del> }
<del>
<del> /**
<del> * Set the expiration time in seconds.
<del> *
<del> * @param int|null $seconds
<del> * @return void
<del> */
<del> public function setExpire($seconds)
<del> {
<del> $this->expire = $seconds;
<del> }
<ide> } | 1 |
Ruby | Ruby | fix code style | abaf9c40aec2cc91314b7e86fcb2d9b205c45c4d | <ide><path>Library/Homebrew/cask/cmd.rb
<ide> def process_options(*args)
<ide> begin
<ide> arg = all_args[i]
<ide>
<del> unless process_arguments([arg]).empty?
<del> remaining << arg
<del> end
<add> remaining << arg unless process_arguments([arg]).empty?
<ide> rescue OptionParser::MissingArgument
<ide> raise if i + 1 >= all_args.count
<ide>
<ide><path>Library/Homebrew/cask/dsl.rb
<ide> def language_eval
<ide>
<ide> locales = cask.config.languages
<ide> .map do |language|
<del> Locale.parse(language)
<del> rescue Locale::ParserError
<del> nil
<del> end
<add> Locale.parse(language)
<add> rescue Locale::ParserError
<add> nil
<add> end
<ide> .compact
<ide>
<ide> locales.each do |locale| | 2 |
Text | Text | show print instead of return on threeprinciples.md | 3c95086d7424b9b6921a712e042b835e50e6e605 | <ide><path>docs/introduction/ThreePrinciples.md
<ide> This makes it easy to create universal apps, as the state from your server can b
<ide> ```js
<ide> console.log(store.getState())
<ide>
<del>/* returns
<add>/* Prints
<ide> {
<ide> visibilityFilter: 'SHOW_ALL',
<ide> todos: [ | 1 |
Java | Java | move uimanager annotations to separate package | c1b7a369af7ca457819d682b15f47fae7e2732fc | <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java
<ide> import android.view.View;
<ide>
<ide> import com.facebook.react.bridge.ReadableMap;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide>
<ide> /**
<ide> * Base class that should be suitable for the majority of subclasses of {@link ViewManager}.
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java
<ide> import com.facebook.csslayout.CSSJustify;
<ide> import com.facebook.csslayout.CSSPositionType;
<ide> import com.facebook.csslayout.CSSWrap;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactPropGroup;
<ide>
<ide> /**
<ide> * Supply setters for base view layout properties such as width, height, flex properties,
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java
<ide> import com.facebook.react.bridge.ReadableMapKeySetIterator;
<ide> import com.facebook.react.touch.CatalystInterceptingViewGroup;
<ide> import com.facebook.react.touch.JSResponderHandler;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactPropGroup;
<ide>
<ide> /**
<ide> * Class responsible for knowing how to create and update catalyst Views of a given type. It is also
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java
<ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.bridge.ReadableMap;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactPropGroup;
<ide>
<ide> /**
<ide> * This class is responsible for holding view manager property setters and is used in a process of
<add><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactProp.java
<del><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactProp.java
<ide> // Copyright 2004-present Facebook. All Rights Reserved.
<ide>
<del>package com.facebook.react.uimanager;
<add>package com.facebook.react.uimanager.annotations;
<ide>
<ide> import javax.annotation.Nullable;
<ide>
<ide>
<ide> /**
<ide> * Use this annotation to annotate properties of native views that should be exposed to JS. This
<del> * annotation should only be used for setter methods of subclasses of {@link ViewManager}.
<add> * annotation should only be used for setter methods of subclasses of
<add> * {@link com.facebook.react.uimanager.ViewManager}.
<ide> *
<ide> * Each annotated method should return {@code void} and take exactly two arguments: first being
<ide> * a view instance to be updated and second a value that should be set.
<ide> * - primitives (int, boolean, double, float)
<ide> * - {@link String}
<ide> * - {@link Boolean}
<del> * - {@link ReadableArray}
<del> * - {@link ReadableMap}
<add> * - {@link com.facebook.react.bridge.ReadableArray}
<add> * - {@link com.facebook.react.bridge.ReadableMap}
<ide> *
<ide> * When property gets removed from the corresponding component in React, annotated setter will be
<ide> * called with {@code null} in case of non-primitive value type or with a default value in case when
<add><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropGroup.java
<del><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPropGroup.java
<ide> // Copyright 2004-present Facebook. All Rights Reserved.
<ide>
<del>package com.facebook.react.uimanager;
<add>package com.facebook.react.uimanager.annotations;
<ide>
<ide> import javax.annotation.Nullable;
<ide>
<ide>
<ide> /**
<ide> * Use this annotation to annotate group of properties of native views that should be exposed to JS.
<del> * This annotation should only be used for setter methods of subclasses of {@link ViewManager}. It's
<del> * a batched version of {@link ReactProp} annotation (please see documentation of {@link ReactProp}
<del> * for more details about how this annotation can be used).
<add> * This annotation should only be used for setter methods of subclasses of
<add> * {@link com.facebook.react.uimanager.ViewManager}. It's a batched version of {@link ReactProp}
<add> * annotation (please see documentation of {@link ReactProp} for more details about how this
<add> * annotation can be used).
<ide> *
<ide> * This annotation is meant to be used for a group of similar properties. That's why it support only
<ide> * a set of properties of the same type. A good example is supporting "border", where we have 7
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/art/ARTShapeShadowNode.java
<ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.common.ReactConstants;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide>
<ide> /**
<ide> * Shadow node for virtual ARTShape view
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/art/ARTTextShadowNode.java
<ide>
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.bridge.ReadableMap;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide>
<ide> /**
<ide> * Shadow node for virtual ARTText view
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/art/ARTVirtualNode.java
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.uimanager.CatalystStylesDiffMap;
<ide> import com.facebook.react.uimanager.DisplayMetricsHolder;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ReactShadowNode;
<ide>
<ide> /**
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.common.MapBuilder;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java
<ide> import com.facebook.drawee.backends.pipeline.Fresco;
<ide> import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
<ide> import com.facebook.react.common.MapBuilder;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.SimpleViewManager;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewProps;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.java
<ide> import com.facebook.csslayout.CSSNode;
<ide> import com.facebook.csslayout.MeasureOutput;
<ide> import com.facebook.react.uimanager.LayoutShadowNode;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide>
<ide> /**
<ide> * Node responsible for holding the style of the ProgressBar, see under
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java
<ide>
<ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
<ide> import com.facebook.react.uimanager.BaseViewManager;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewProps;
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/recyclerview/RecyclerViewBackedScrollViewManager.java
<ide>
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.common.MapBuilder;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide> import com.facebook.react.views.scroll.ReactScrollViewCommandHelper;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java
<ide> import javax.annotation.Nullable;
<ide>
<ide> import com.facebook.react.bridge.ReadableArray;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java
<ide>
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.common.MapBuilder;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide> import com.facebook.react.views.view.ReactClippingViewGroupHelper;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java
<ide>
<ide> import com.facebook.react.bridge.ReadableArray;
<ide> import com.facebook.react.common.MapBuilder;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java
<ide> import com.facebook.csslayout.MeasureOutput;
<ide> import com.facebook.react.bridge.ReactContext;
<ide> import com.facebook.react.uimanager.LayoutShadowNode;
<del>import com.facebook.react.uimanager.ReactProp;
<del>import com.facebook.react.uimanager.ReactShadowNode;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.SimpleViewManager;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java
<ide> import com.facebook.common.util.UriUtil;
<ide> import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
<ide> import com.facebook.react.uimanager.LayoutShadowNode;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ReactShadowNode;
<ide>
<ide> /**
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java
<ide> import com.facebook.react.uimanager.IllegalViewOperationException;
<ide> import com.facebook.react.uimanager.LayoutShadowNode;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ReactShadowNode;
<ide> import com.facebook.react.uimanager.UIViewOperationQueue;
<ide> import com.facebook.react.uimanager.ViewDefaults;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java
<ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
<ide> import com.facebook.react.uimanager.BaseViewManager;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewDefaults;
<ide> import com.facebook.react.uimanager.ViewProps;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
<ide> import com.facebook.react.common.MapBuilder;
<ide> import com.facebook.react.uimanager.BaseViewManager;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide> import com.facebook.react.uimanager.ViewDefaults;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java
<ide> import com.facebook.infer.annotation.Assertions;
<ide> import com.facebook.react.common.annotations.VisibleForTesting;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIViewOperationQueue;
<ide> import com.facebook.react.uimanager.ViewDefaults;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbarManager.java
<ide> import com.facebook.react.bridge.ReadableMap;
<ide> import com.facebook.react.common.MapBuilder;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java
<ide> import java.util.Locale;
<ide> import java.util.Map;
<ide>
<del>import android.graphics.Color;
<ide> import android.os.Build;
<ide> import android.view.View;
<ide>
<ide> import com.facebook.react.bridge.ReadableMap;
<ide> import com.facebook.react.common.MapBuilder;
<ide> import com.facebook.react.common.annotations.VisibleForTesting;
<del>import com.facebook.react.uimanager.CatalystStylesDiffMap;
<ide> import com.facebook.react.uimanager.PixelUtil;
<ide> import com.facebook.react.uimanager.PointerEvents;
<del>import com.facebook.react.uimanager.ReactProp;
<del>import com.facebook.react.uimanager.ReactPropGroup;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactPropGroup;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.ViewGroupManager;
<ide> import com.facebook.react.uimanager.ViewProps;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java
<ide> import com.facebook.react.bridge.WritableMap;
<ide> import com.facebook.react.common.MapBuilder;
<ide> import com.facebook.react.common.build.ReactBuildConfig;
<del>import com.facebook.react.uimanager.ReactProp;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.SimpleViewManager;
<ide> import com.facebook.react.uimanager.ThemedReactContext;
<ide> import com.facebook.react.uimanager.UIManagerModule; | 26 |
Javascript | Javascript | add closure externs for angular.$q.promise.finally | caeb7402651702cd13df2f1594e9827439a8b760 | <ide><path>closure/angular.js
<ide> angular.$q.Promise;
<ide> */
<ide> angular.$q.Promise.then = function(successCallback, opt_errorCallback) {};
<ide>
<add>/**
<add> * @param {?function(?)} callback
<add> * @return {angular.$q.Promise}
<add> */
<add>angular.$q.Promise.finally = function(callback) {};
<add>
<ide> /******************************************************************************
<ide> * $route Service
<ide> *****************************************************************************/ | 1 |
Javascript | Javascript | increase coverage for blob | d5c734587c347dbb76d929e2aef70fa65e1937d0 | <ide><path>test/parallel/test-blob.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide> const { Blob } = require('buffer');
<add>const { inspect } = require('util');
<ide>
<ide> {
<ide> const b = new Blob();
<ide> assert.throws(() => new Blob({}), {
<ide> assert.strictEqual(text, 'test42');
<ide> }));
<ide> }
<add>
<add>{
<add> const b = new Blob();
<add> assert.strictEqual(inspect(b, { depth: null }),
<add> 'Blob { size: 0, type: \'\' }');
<add> assert.strictEqual(inspect(b, { depth: -1 }), '[Blob]');
<add>} | 1 |
Go | Go | add import test for cve-2017-14992 | 0a13f827a10d3bf61744d9b3f7165c5885a39c5d | <ide><path>integration/image/import_test.go
<add>package image
<add>
<add>import (
<add> "archive/tar"
<add> "bytes"
<add> "context"
<add> "io"
<add> "testing"
<add>
<add> "github.com/docker/docker/api/types"
<add> "github.com/docker/docker/integration/util/request"
<add> "github.com/docker/docker/internal/testutil"
<add>)
<add>
<add>// Ensure we don't regress on CVE-2017-14992.
<add>func TestImportExtremelyLargeImageWorks(t *testing.T) {
<add> client := request.NewAPIClient(t)
<add>
<add> // Construct an empty tar archive with about 8GB of junk padding at the
<add> // end. This should not cause any crashes (the padding should be mostly
<add> // ignored).
<add> var tarBuffer bytes.Buffer
<add> tw := tar.NewWriter(&tarBuffer)
<add> if err := tw.Close(); err != nil {
<add> t.Fatal(err)
<add> }
<add> imageRdr := io.MultiReader(&tarBuffer, io.LimitReader(testutil.DevZero, 8*1024*1024*1024))
<add>
<add> _, err := client.ImageImport(context.Background(),
<add> types.ImageImportSource{Source: imageRdr, SourceName: "-"},
<add> "test1234:v42",
<add> types.ImageImportOptions{})
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>} | 1 |
Go | Go | update remote driver to use destiantion prefix | 3c0d5c3a8ba273fe433b17e7118a9c5f68236de9 | <ide><path>libnetwork/drivers/remote/driver.go
<ide> func (d *driver) Join(nid, eid types.UUID, sboxKey string, jinfo driverapi.JoinI
<ide> return fmt.Errorf("no correlating interface %d in supplied interface names", i)
<ide> }
<ide> supplied := ifaceNames[i]
<del> if err := iface.SetNames(supplied.SrcName, supplied.DstName); err != nil {
<add> if err := iface.SetNames(supplied.SrcName, supplied.DstPrefix); err != nil {
<ide> return errorWithRollback(fmt.Sprintf("failed to set interface name: %s", err), d.Leave(nid, eid))
<ide> }
<ide> }
<ide><path>libnetwork/drivers/remote/driver_test.go
<ide> func (test *testEndpoint) SetNames(src string, dst string) error {
<ide> test.t.Fatalf(`Wrong SrcName; expected "%s", got "%s"`, test.src, src)
<ide> }
<ide> if test.dst != dst {
<del> test.t.Fatalf(`Wrong DstName; expected "%s", got "%s"`, test.dst, dst)
<add> test.t.Fatalf(`Wrong DstPrefix; expected "%s", got "%s"`, test.dst, dst)
<ide> }
<ide> return nil
<ide> }
<ide> func TestRemoteDriver(t *testing.T) {
<ide> "ResolvConfPath": ep.resolvConfPath,
<ide> "InterfaceNames": []map[string]interface{}{
<ide> map[string]interface{}{
<del> "SrcName": ep.src,
<del> "DstName": ep.dst,
<add> "SrcName": ep.src,
<add> "DstPrefix": ep.dst,
<ide> },
<ide> },
<ide> }
<ide><path>libnetwork/drivers/remote/messages.go
<ide> type joinRequest struct {
<ide> }
<ide>
<ide> type ifaceName struct {
<del> SrcName string
<del> DstName string
<add> SrcName string
<add> DstPrefix string
<ide> }
<ide>
<ide> type joinResponse struct { | 3 |
Javascript | Javascript | get all promises when using multiple test files | b0b3cd209d6c4e99eabb707d15fb86eded1c2393 | <ide><path>test/ConfigTestCases.template.js
<ide> const describeCases = config => {
<ide> }
<ide> };
<ide>
<del> results.push(
<del> _require(outputDirectory, optionsArr[i], bundlePath)
<del> );
<add> if (Array.isArray(bundlePath)) {
<add> for (const bundlePathItem of bundlePath) {
<add> results.push(
<add> _require(
<add> outputDirectory,
<add> optionsArr[i],
<add> "./" + bundlePathItem
<add> )
<add> );
<add> }
<add> } else {
<add> results.push(
<add> _require(outputDirectory, optionsArr[i], bundlePath)
<add> );
<add> }
<ide> }
<ide> }
<ide> // give a free pass to compilation that generated an error | 1 |
Go | Go | fix shallow git clone in docker-build | 85afbbc2ed36945adeaf6fa09f6066a549631a6f | <ide><path>builder/remotecontext/git/gitutils.go
<ide> package git
<ide>
<ide> import (
<del> "fmt"
<ide> "io/ioutil"
<ide> "net/http"
<ide> "net/url"
<ide> func getRefAndSubdir(fragment string) (ref string, subdir string) {
<ide>
<ide> func fetchArgs(remoteURL string, ref string) []string {
<ide> args := []string{"fetch", "--recurse-submodules=yes"}
<del> shallow := true
<ide>
<del> if urlutil.IsURL(remoteURL) {
<del> res, err := http.Head(fmt.Sprintf("%s/info/refs?service=git-upload-pack", remoteURL))
<del> if err != nil || res.Header.Get("Content-Type") != "application/x-git-upload-pack-advertisement" {
<del> shallow = false
<del> }
<del> }
<del>
<del> if shallow {
<add> if supportsShallowClone(remoteURL) {
<ide> args = append(args, "--depth", "1")
<ide> }
<ide>
<ide> return append(args, "origin", ref)
<ide> }
<ide>
<add>// Check if a given git URL supports a shallow git clone,
<add>// i.e. it is a non-HTTP server or a smart HTTP server.
<add>func supportsShallowClone(remoteURL string) bool {
<add> if urlutil.IsURL(remoteURL) {
<add> // Check if the HTTP server is smart
<add>
<add> // Smart servers must correctly respond to a query for the git-upload-pack service
<add> serviceURL := remoteURL + "/info/refs?service=git-upload-pack"
<add>
<add> // Try a HEAD request and fallback to a Get request on error
<add> res, err := http.Head(serviceURL)
<add> if err != nil || res.StatusCode != http.StatusOK {
<add> res, err = http.Get(serviceURL)
<add> if err == nil {
<add> res.Body.Close()
<add> }
<add> if err != nil || res.StatusCode != http.StatusOK {
<add> // request failed
<add> return false
<add> }
<add> }
<add>
<add> if res.Header.Get("Content-Type") != "application/x-git-upload-pack-advertisement" {
<add> // Fallback, not a smart server
<add> return false
<add> }
<add> return true
<add> }
<add> // Non-HTTP protocols always support shallow clones
<add> return true
<add>}
<add>
<ide> func checkoutGit(root, ref, subdir string) (string, error) {
<ide> // Try checking out by ref name first. This will work on branches and sets
<ide> // .git/HEAD to the current branch name | 1 |
Python | Python | change seq2seqtransformer inputs to dictionary | f3641f23b2f82cb98503bdd27d3e22077d3bf90b | <ide><path>official/nlp/modeling/models/seq2seq_transformer.py
<ide> def call(self, inputs):
<ide> """Calculate target logits or inferred target sequences.
<ide>
<ide> Args:
<del> inputs: input tensor list of size 1 or 2.
<del> First item, inputs: int tensor with shape [batch_size, input_length].
<del> Second item (optional), targets: None or int tensor with shape
<add> inputs: a dictionary of tensors.
<add> Feature `inputs`: int tensor with shape [batch_size, input_length].
<add> Feature `targets` (optional): None or int tensor with shape
<ide> [batch_size, target_length].
<ide>
<ide> Returns:
<ide> def call(self, inputs):
<ide> Raises:
<ide> NotImplementedError: If try to use padded decode method on CPU/GPUs.
<ide> """
<del> inputs = inputs if isinstance(inputs, list) else [inputs]
<del> if len(inputs) == 2:
<del> sources, targets = inputs[0], inputs[1]
<del> else:
<del> # Decoding path.
<del> sources, targets = inputs[0], None
<add> sources = inputs["inputs"]
<add> targets = inputs.get("targets", None)
<ide> attention_bias = model_utils.get_padding_bias(sources)
<ide> attention_bias = tf.cast(attention_bias, self._dtype)
<ide> # Prepare inputs to the layer stack by adding positional encodings and
<ide><path>official/nlp/modeling/models/seq2seq_transformer_test.py
<ide> def _step_fn(inputs):
<ide> return tf.nest.map_structure(distribution.experimental_local_results,
<ide> outputs)
<ide>
<del> fake_inputs = [np.zeros((batch_size, decode_max_length), dtype=np.int32)]
<add> fake_inputs = dict(
<add> inputs=np.zeros((batch_size, decode_max_length), dtype=np.int32))
<ide> local_outputs = step(fake_inputs)
<ide> logging.info("local_outputs=%s", local_outputs)
<ide> self.assertEqual(local_outputs["outputs"][0].shape, (4, 10))
<ide>
<del> fake_inputs = [
<del> np.zeros((batch_size, decode_max_length), dtype=np.int32),
<del> np.zeros((batch_size, 8), dtype=np.int32)
<del> ]
<add> fake_inputs = dict(
<add> inputs=np.zeros((batch_size, decode_max_length), dtype=np.int32),
<add> targets=np.zeros((batch_size, 8), dtype=np.int32))
<ide> local_outputs = step(fake_inputs)
<ide> logging.info("local_outputs=%s", local_outputs)
<ide> self.assertEqual(local_outputs[0].shape, (4, 8, 100))
<ide> def __init__(self, model):
<ide>
<ide> @tf.function
<ide> def serve(self, inputs):
<del> return self.model.call([inputs])
<add> return self.model.call(dict(inputs=inputs))
<ide>
<ide> save_module = SaveModule(model)
<ide> if padded_decode:
<ide><path>official/nlp/transformer/transformer_forward_test.py
<ide> def _create_model(params, is_train):
<ide> inputs = tf.keras.layers.Input((None,), dtype="int64", name="inputs")
<ide> targets = tf.keras.layers.Input((None,), dtype="int64", name="targets")
<ide> internal_model = models.Seq2SeqTransformer(**model_kwargs)
<del> logits = internal_model([inputs, targets], training=is_train)
<add> logits = internal_model(
<add> dict(inputs=inputs, targets=targets), training=is_train)
<ide> vocab_size = params["vocab_size"]
<ide> label_smoothing = params["label_smoothing"]
<ide> if params["enable_metrics_in_training"]:
<ide> def _create_model(params, is_train):
<ide> dtype="int64",
<ide> name="inputs")
<ide> internal_model = models.Seq2SeqTransformer(**model_kwargs)
<del> ret = internal_model([inputs], training=is_train)
<add> ret = internal_model(dict(inputs=inputs), training=is_train)
<ide> outputs, scores = ret["outputs"], ret["scores"]
<ide> return tf.keras.Model(inputs, [outputs, scores])
<ide> | 3 |
Ruby | Ruby | fix redefinition of x11 reader method in superenv | b0c1e5f7d6456ea3b350d13383f9fbc72f410c20 | <ide><path>Library/Homebrew/extend/ENV/super.rb
<ide> def noop(*args); end
<ide>
<ide> # These methods are no longer necessary under superenv, but are needed to
<ide> # maintain an interface compatible with stdenv.
<del> noops.concat %w{fast O4 Og libxml2 x11 set_cpu_flags macosxsdk remove_macosxsdk}
<add> noops.concat %w{fast O4 Og libxml2 set_cpu_flags macosxsdk remove_macosxsdk}
<ide>
<ide> # These methods provide functionality that has not yet been ported to
<ide> # superenv. | 1 |
Ruby | Ruby | reduce blank? checks | f0eff10c090a56ea28201341361439dfbc31485b | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def default_controller_and_action
<ide> end
<ide> end
<ide>
<del> controller = controller.to_s unless controller.is_a?(Regexp)
<add> hash = {}
<add>
<ide> action = action.to_s unless action.is_a?(Regexp)
<ide>
<add> if controller.is_a? Regexp
<add> hash[:controller] = controller
<add> else
<add> check_controller! controller.to_s
<add> hash[:controller] = controller.to_s if controller
<add> end
<add>
<ide> check_action! action
<del> check_controller! controller
<ide>
<del> hash = {}
<del> hash[:controller] = controller unless controller.blank?
<ide> hash[:action] = action unless action.blank?
<ide> hash
<ide> end | 1 |
Mixed | Text | remove support for the protected attributes gem | f4fbc0301021f13ae05c8e941c8efc4ae351fdf9 | <ide><path>activerecord/CHANGELOG.md
<add>* Remove support for the `protected_attributes` gem.
<add>
<add> *Carlos Antonio da Silva + Roberto Miranda*
<add>
<ide> * Fix accessing of fixtures having non-string labels like Fixnum.
<ide>
<ide> *Prathamesh Sonpatki*
<ide><path>activerecord/lib/active_record/core.rb
<ide> def table_metadata # :nodoc:
<ide> # ==== Example:
<ide> # # Instantiates a single new object
<ide> # User.new(first_name: 'Jamie')
<del> def initialize(attributes = nil, options = {})
<add> def initialize(attributes = nil)
<ide> @attributes = self.class._default_attributes.dup
<ide> self.class.define_attribute_methods
<ide>
<ide> init_internals
<ide> initialize_internals_callback
<ide>
<del> # +options+ argument is only needed to make protected_attributes gem easier to hook.
<del> # Remove it when we drop support to this gem.
<del> init_attributes(attributes, options) if attributes
<add> assign_attributes(attributes) if attributes
<ide>
<ide> yield self if block_given?
<ide> _run_initialize_callbacks
<ide> def init_internals
<ide> def initialize_internals_callback
<ide> end
<ide>
<del> # This method is needed to make protected_attributes gem easier to hook.
<del> # Remove it when we drop support to this gem.
<del> def init_attributes(attributes, options)
<del> assign_attributes(attributes)
<del> end
<del>
<ide> def thaw
<ide> if frozen?
<ide> @attributes = @attributes.dup | 2 |
Javascript | Javascript | replace common.fixturesdir with fixtures | eb08e3e5fb71d9f33ff97e1ce4605fbf5a60315c | <ide><path>test/parallel/test-fs-write-stream-encoding.js
<ide> 'use strict';
<ide> const common = require('../common');
<ide> const assert = require('assert');
<add>const fixtures = require('../common/fixtures');
<ide> const fs = require('fs');
<ide> const path = require('path');
<ide> const stream = require('stream');
<ide> const firstEncoding = 'base64';
<ide> const secondEncoding = 'latin1';
<ide>
<del>const examplePath = path.join(common.fixturesDir, 'x.txt');
<add>const examplePath = fixtures.path('x.txt');
<ide> const dummyPath = path.join(common.tmpDir, 'x.txt');
<ide>
<ide> common.refreshTmpDir(); | 1 |
Text | Text | use descriptive links instead of "click here" | c6ba29da00a16ecc49f615752bb1490bab8ed9fb | <ide><path>contributing.md
<ide> # Contributing to Next.js
<ide>
<del>Our Commitment to Open Source can be found [here](https://vercel.com/oss).
<add>Read about our [Commitment to Open Source](https://vercel.com/oss).
<ide>
<ide> 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
<ide> 2. Create a new branch: `git checkout -b MY_BRANCH_NAME`
<ide><path>docs/advanced-features/amp-support/typescript.md
<ide> description: Using AMP with TypeScript? Extend your typings to allow AMP compone
<ide>
<ide> AMP currently doesn't have built-in types for TypeScript, but it's in their roadmap ([#13791](https://github.com/ampproject/amphtml/issues/13791)).
<ide>
<del>As a workaround you can manually create a file called `amp.d.ts` inside your project and add the custom types described [here](https://stackoverflow.com/a/50601125).
<add>As a workaround you can manually create a file called `amp.d.ts` inside your project and add these [custom types](https://stackoverflow.com/a/50601125).
<ide><path>docs/advanced-features/measuring-performance.md
<ide> export function reportWebVitals(metric) {
<ide> > }
<ide> > ```
<ide> >
<del>> Read more about sending results to Google Analytics [here](https://github.com/GoogleChrome/web-vitals#send-the-results-to-google-analytics).
<add>> Read more about [sending results to Google Analytics](https://github.com/GoogleChrome/web-vitals#send-the-results-to-google-analytics).
<ide>
<ide> ## TypeScript
<ide>
<ide><path>docs/api-reference/next.config.js/introduction.md
<ide> module.exports = (phase, { defaultConfig }) => {
<ide> }
<ide> ```
<ide>
<del>`phase` is the current context in which the configuration is loaded. You can see the available phases [here](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/lib/constants.ts#L1-L4). Phases can be imported from `next/constants`:
<add>`phase` is the current context in which the configuration is loaded. You can see the [available phases](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/lib/constants.ts#L1-L4). Phases can be imported from `next/constants`:
<ide>
<ide> ```js
<ide> const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
<ide> module.exports = (phase, { defaultConfig }) => {
<ide> }
<ide> ```
<ide>
<del>The commented lines are the place where you can put the configs allowed by `next.config.js`, which are defined [here](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/config-shared.ts#L68).
<add>The commented lines are the place where you can put the configs allowed by `next.config.js`, which are [defined in this file](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/config-shared.ts#L68).
<ide>
<ide> However, none of the configs are required, and it's not necessary to understand what each config does. Instead, search for the features you need to enable or modify in this section and they will show you what to do.
<ide>
<ide><path>docs/api-reference/next/amp.md
<ide> description: Enable AMP in a page, and control the way Next.js adds AMP to the p
<ide> </ul>
<ide> </details>
<ide>
<del>> AMP support is one of our advanced features, you can read more about it [here](/docs/advanced-features/amp-support/introduction.md).
<add>> AMP support is one of our advanced features, you can [read more about AMP here](/docs/advanced-features/amp-support/introduction.md).
<ide>
<ide> To enable AMP, add the following config to your page:
<ide>
<ide><path>docs/api-routes/introduction.md
<ide> export default function handler(req, res) {
<ide>
<ide> For an API route to work, you need to export a function as default (a.k.a **request handler**), which then receives the following parameters:
<ide>
<del>- `req`: An instance of [http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage), plus some pre-built middlewares you can see [here](/docs/api-routes/api-middlewares.md)
<del>- `res`: An instance of [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse), plus some helper functions you can see [here](/docs/api-routes/response-helpers.md)
<add>- `req`: An instance of [http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage), plus some [pre-built middlewares](/docs/api-routes/api-middlewares.md)
<add>- `res`: An instance of [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse), plus some [helper functions](/docs/api-routes/response-helpers.md)
<ide>
<ide> To handle different HTTP methods in an API route, you can use `req.method` in your request handler, like so:
<ide>
<ide><path>docs/authentication.md
<ide> const Profile = () => {
<ide> export default Profile
<ide> ```
<ide>
<del>You can view this example in action [here](https://next-with-iron-session.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works.
<add>You can view this [example in action](https://next-with-iron-session.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works.
<ide>
<ide> ### Authenticating Server-Rendered Pages
<ide>
<ide><path>errors/postcss-ignored-plugin.md
<ide> Remove the plugin specified in the error message from your custom PostCSS config
<ide> #### How do I configure CSS Modules?
<ide>
<ide> CSS Modules are supported in [Next.js' built-in CSS support](https://nextjs.org/docs/advanced-features/customizing-postcss-config).
<del>You can [read more](https://nextjs.org/docs/advanced-features/customizing-postcss-config) about how to use them [here](https://nextjs.org/docs/advanced-features/customizing-postcss-config).
<add>You can [read more about how to use CSS Modules here](https://nextjs.org/docs/advanced-features/customizing-postcss-config).
<ide><path>errors/postcss-shape.md
<ide> module.exports = {
<ide> }
<ide> ```
<ide>
<del>You can [read more](https://nextjs.org/docs/advanced-features/customizing-postcss-config) about configuring PostCSS in Next.js [here](https://nextjs.org/docs/advanced-features/customizing-postcss-config).
<add>You can [read more about configuring PostCSS in Next.js here](https://nextjs.org/docs/advanced-features/customizing-postcss-config).
<ide>
<ide> #### Common Errors
<ide>
<ide><path>examples/amp-first/README.md
<ide> # AMP First Boilerplate ⚡
<ide>
<del>This example sets up the boilerplate for an AMP First Site. You can see a live version [here](https://my-next-app.sebastianbenz.vercel.app). The boilerplate includes the following features:
<add>This example sets up the boilerplate for an AMP First Site. You can see a [live version here](https://my-next-app.sebastianbenz.vercel.app). The boilerplate includes the following features:
<ide>
<ide> - AMP Extension helpers (`amp-state`, `amp-script`, ...)
<ide> - AMP Serviceworker integration
<ide><path>examples/i18n-routing/README.md
<ide>
<ide> This example shows how to create internationalized pages using Next.js and the i18n routing feature. It shows a normal page, a non-dynamic `getStaticProps` page, a dynamic `getStaticProps` page, and a `getServerSideProps` page.
<ide>
<del>For further documentation on this feature see the documentation [here](https://nextjs.org/docs/advanced-features/i18n-routing)
<add>For further documentation on this feature see the [Internationalized Routing docs](https://nextjs.org/docs/advanced-features/i18n-routing).
<ide>
<ide> ## Preview
<ide>
<ide><path>examples/with-electron/README.md
<ide> This example shows how you can use Next.js inside an Electron application to avo
<ide>
<ide> For development it's going to run an HTTP server and let Next.js handle routing. In production it uses `next export` to pre-generate HTML static files and uses them in your app instead of running an HTTP server.
<ide>
<del>**You can find a detailed documentation about how to build Electron apps with Next.js [here](https://leo.im/2017/electron-next)!**
<add>**For detailed documentation about how to build Electron apps with Next.js, see [this blog post](https://leo.im/2017/electron-next)!**
<ide>
<ide> ## How to use
<ide>
<ide><path>examples/with-netlify-cms/content/home.md
<ide> date: 2019-03-17T19:31:20.591Z
<ide>
<ide> ## Welcome to the Home Page
<ide>
<del>If you want to know more about Next.js + Netlifycms go to the official tutorial [here](https://www.netlifycms.org/docs/nextjs/).
<add>If you want to know more about Next.js + Netlify CMS go to their [official tutorial](https://www.netlifycms.org/docs/nextjs/).
<ide><path>examples/with-passport/README.md
<ide> This example show how to use [Passport.js](http://www.passportjs.org) with Next.
<ide>
<ide> The example shows how to do a login, signup and logout; and to get the user info using a hook with [SWR](https://swr.vercel.app).
<ide>
<del>A DB is not included. You can use any db you want and add it [here](lib/user.js).
<add>A database is not included. You can use any database you want and add it [in this file](lib/user.js).
<ide>
<ide> The login cookie is httpOnly, meaning it can only be accessed by the API, and it's encrypted using [@hapi/iron](https://hapi.dev/family/iron) for more security.
<ide>
<ide><path>examples/with-rematch/README.md
<ide>
<ide> This example has two pages. The first page has a counter which can be incremented synchronously or asynchronously. The second page is a page which shows a list of github users. It fetches data from the github api using this [endpoint](api.github.com/users).
<ide>
<del>Since rematch is utility which uses redux under the hood, some elements like `store.js` and `withRematch` are very similar to the `with-redux` example. Please go through the `with-redux` example [here](https://github.com/vercel/next.js/tree/master/examples/with-redux) before reading further if you are not familiar with how redux is integrated with nextjs. Rematch is just an extension for Redux so a lot of elements are the same.
<add>Since rematch is utility which uses redux under the hood, some elements like `store.js` and `withRematch` are very similar to the `with-redux` example. Please go through the [`with-redux` example](https://github.com/vercel/next.js/tree/master/examples/with-redux) before reading further if you are not familiar with how redux is integrated with Next.js. Rematch is just an extension for Redux so a lot of elements are the same.
<ide>
<ide> ## Preview
<ide>
<ide><path>examples/with-stencil/packages/test-component/readme.md
<ide> To run the unit tests for the components, run:
<ide> npm test
<ide> ```
<ide>
<del>Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).
<add>Need help? [Check out our docs](https://stenciljs.com/docs/my-first-component).
<ide>
<ide> ## Naming Components
<ide>
<ide><path>examples/with-unsplash/README.md
<ide> First, you'll need to [create an account on Unsplash](https://unsplash.com/) if
<ide>
<ide> ### Step 1. Create an app on Unsplash
<ide>
<del>To create a new application on Unsplash, click [here](https://unsplash.com/oauth/applications/new) or go to https://unsplash.com/oauth/applications/new.
<add>Create a [new application on Unsplash](https://unsplash.com/oauth/applications/new).
<ide>
<ide> Before creating an app you'll have to accept the terms for API use:
<ide>
<ide><path>examples/with-xstate/README.md
<ide> # XState example
<ide>
<del>This example shows how to integrate XState in Next.js. For more info about XState you can visit [here](https://xstate.js.org/).
<add>This example shows how to integrate XState in Next.js. [Learn more about XState](https://xstate.js.org/).
<ide>
<ide> ## Preview
<ide> | 18 |
PHP | PHP | remove illogic test | 7834fe3f4e192008d24a2f82c284e4740ecb74e9 | <ide><path>tests/View/Blade/BladeComponentsTest.php
<ide> public function testComponentsAreCompiled()
<ide> $this->assertSame('<?php $__env->startComponent(\'foo\'); ?>', $this->compiler->compileString('@component(\'foo\')'));
<ide> }
<ide>
<del> public function testExtraAttributesCanBePassedToComponents()
<del> {
<del> $this->assertSame('<?php $__env->startComponent(\'foo\', ["foo" => "bar"], ["foo" => "bar"]); ?>', $this->compiler->compileString('@component(\'foo\', ["foo" => "bar"], ["foo" => "bar"])'));
<del> }
<del>
<ide> public function testClassComponentsAreCompiled()
<ide> {
<ide> $this->assertSame('<?php if (isset($component)) { $__componentOriginal35bda42cbf6f9717b161c4f893644ac7a48b0d98 = $component; } ?> | 1 |
Javascript | Javascript | pass accessibilityhint through button component | be5372801a3ac3ae0f1df76c33f8b5f96ea68828 | <ide><path>Libraries/Components/Button.js
<ide> type ButtonProps = $ReadOnly<{|
<ide> accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
<ide> onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
<ide> accessibilityState?: ?AccessibilityState,
<add> accessibilityHint?: ?string,
<ide> |}>;
<ide>
<ide> /**
<ide> class Button extends React.Component<ButtonProps> {
<ide> testID,
<ide> accessible,
<ide> accessibilityActions,
<add> accessibilityHint,
<ide> onAccessibilityAction,
<ide> } = this.props;
<ide> const buttonStyles = [styles.button];
<ide> class Button extends React.Component<ButtonProps> {
<ide> accessibilityActions={accessibilityActions}
<ide> onAccessibilityAction={onAccessibilityAction}
<ide> accessibilityLabel={accessibilityLabel}
<add> accessibilityHint={accessibilityHint}
<ide> accessibilityRole="button"
<ide> accessibilityState={accessibilityState}
<ide> hasTVPreferredFocus={hasTVPreferredFocus} | 1 |
Javascript | Javascript | fix process.stdout.end() throws enotsock error | 0a51a6d3ac0818244ab4d73a72a541d3e8b65110 | <ide><path>lib/tty_posix.js
<ide> function ReadStream(fd) {
<ide> if (!(this instanceof ReadStream)) return new ReadStream(fd);
<ide> net.Socket.call(this, fd);
<ide>
<add> if (this._writeWatcher) {
<add> this._writeWatcher.stop();
<add> this._writeWatcher = null;
<add> }
<add> this.writable = false;
<add>
<ide> var self = this,
<ide> keypressListeners = this.listeners('keypress');
<ide>
<ide> ReadStream.prototype._emitKey = function(s) {
<ide> function WriteStream(fd) {
<ide> if (!(this instanceof WriteStream)) return new WriteStream(fd);
<ide> net.Socket.call(this, fd);
<add>
<add> if (this._readWatcher) {
<add> this._readWatcher.stop();
<add> this._readWatcher = null;
<add> }
<add> this.readable = false;
<ide> }
<ide> inherits(WriteStream, net.Socket);
<ide> exports.WriteStream = WriteStream;
<ide><path>test/disabled/test-tty-stdio.js
<add>// Can't test this when 'make test' doesn't assign a tty to the stdout.
<add>var common = require('../common');
<add>var assert = require('assert');
<add>var tty = require('tty');
<add>
<add>assert.ok(process.stdin instanceof tty.ReadStream);
<add>assert.ok(process.stdin.readable);
<add>assert.ok(!process.stdin.writable);
<add>
<add>assert.ok(process.stdout instanceof tty.WriteStream);
<add>assert.ok(!process.stdout.readable);
<add>assert.ok(process.stdout.writable);
<ide><path>test/simple/test-tty-stdout-end.js
<add>// Can't test this when 'make test' doesn't assign a tty to the stdout.
<add>var common = require('../common');
<add>var assert = require('assert');
<add>var tty = require('tty');
<add>
<add>var closed = false;
<add>process.stdout.on('close', function() {
<add> closed = true;
<add>});
<add>process.on('exit', function() {
<add> assert.ok(closed);
<add>});
<add>
<add>process.stdout.end(); | 3 |
Javascript | Javascript | add french locale | 80e593a39e0c8e049839c81aaf7ef6edf6a56bc7 | <ide><path>src/locale/fr.js
<add>import "locale";
<add>
<add>d3.locale.fr = d3.locale({
<add> decimal: ",",
<add> thousands: ".",
<add> grouping: [3],
<add> currency: ["", " €"],
<add> dateTime: "%A, le %e %B %Y, %X",
<add> date: "%e/%m/%Y",
<add> time: "%H:%M:%S",
<add> periods: ["AM", "PM"], // unused
<add> days: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
<add> shortDays: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
<add> months: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
<add> shortMonths: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."]
<add>}); | 1 |
Ruby | Ruby | use sort_by instead of sort() | 09d3e89cf0b3e7be03f97739e297fd40ebba1178 | <ide><path>activesupport/lib/active_support/cache.rb
<ide> def expanded_key(key) # :nodoc:
<ide> key.first.to_param
<ide> end
<ide> elsif key.is_a?(Hash)
<del> key = key.to_a.sort{|a,b| a.first.to_s <=> b.first.to_s}.collect{|k,v| "#{k}=#{v}"}.to_param
<add> key = key.to_a.sort_by { |x| x.first.to_s }.collect{|k,v| "#{k}=#{v}"}.to_param
<ide> else
<ide> key = key.to_param
<ide> end | 1 |
Javascript | Javascript | remove extra type check | cd150fa456a160e534a474683c844524b1d3dfb6 | <ide><path>packages/ember-metal/lib/watching.js
<ide> /**
<ide> @module ember-metal
<ide> */
<del>
<ide> import {
<ide> watchKey,
<ide> unwatchKey
<ide> export function watch(obj, _keyPath, m) {
<ide> }
<ide>
<ide> export function isWatching(obj, key) {
<del> if (typeof obj !== 'object' || obj === null) {
<del> return false;
<del> }
<del> let meta = peekMeta(obj);
<del> return (meta && meta.peekWatching(key)) > 0;
<add> return watcherCount(obj, key) > 0;
<ide> }
<ide>
<ide> export function watcherCount(obj, key) {
<ide><path>packages/ember-runtime/lib/computed/computed_macros.js
<ide> export function bool(dependentKey) {
<ide> export function match(dependentKey, regexp) {
<ide> return computed(dependentKey, function() {
<ide> let value = get(this, dependentKey);
<del>
<del> return typeof value === 'string' ? regexp.test(value) : false;
<add> return regexp.test(value);
<ide> });
<ide> }
<ide> | 2 |
Ruby | Ruby | fix frozen pathname usage | 70b07a914fa5d7c713f517111ffe490775b11b71 | <ide><path>Library/Homebrew/cmd/info.rb
<ide> def print_info
<ide> output_analytics
<ide> elsif HOMEBREW_CELLAR.exist?
<ide> count = Formula.racks.length
<del> puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.abv}"
<add> puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}"
<ide> end
<ide> else
<ide> ARGV.named.each_with_index do |f, i| | 1 |
Text | Text | simplify support section of readme | 37e838115021eb88c15c38e6a61eeebbced3c60a | <ide><path>README.md
<ide> When looking for support, please first search for your question in these venues:
<ide> * [Node.js Help][]
<ide> * [Open or closed issues in the Node.js GitHub organization](https://github.com/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+org%3Anodejs+is%3Aissue)
<ide>
<del>If you didn't find an answer in one of the official resources above, you can
<del>search these unofficial resources:
<add>If you didn't find an answer in the resources above, try these unofficial
<add>resources:
<ide>
<ide> * [Questions tagged 'node.js' on StackOverflow][]
<ide> * [#node.js channel on chat.freenode.net][]. See <http://nodeirc.info/> for more
<ide> search these unofficial resources:
<ide> * [Node.js Slack Community](https://node-js.slack.com/): Visit
<ide> [nodeslackers.com](http://www.nodeslackers.com/) to register.
<ide>
<del>GitHub issues are meant for tracking enhancements and bugs, not general support.
<add>GitHub issues are for tracking enhancements and bugs, not general support.
<ide>
<del>Remember, libre != gratis; the open source license grants you the freedom to use
<del>and modify, but not commitments of other people's time. Please be respectful,
<del>and set your expectations accordingly.
<add>The open source license grants you the freedom to use Node.js. It does not
<add>guarantee commitments of other people's time. Please be respectful and manage
<add>your expectations.
<ide>
<ide> ## Release Types
<ide> | 1 |
Text | Text | add qliro to inthewild.md | 348ceb1ce5a0f1bef302c97430f30a3d825088da | <ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [Promofarma](https://www.promofarma.com/) [[@JavierLopezT](https://github.com/JavierLopezT)]
<ide> 1. [Pronto Tools](http://www.prontotools.io/) [[@zkan](https://github.com/zkan) & [@mesodiar](https://github.com/mesodiar)]
<ide> 1. [PubNub](https://pubnub.com) [[@jzucker2](https://github.com/jzucker2)]
<add>1. [Qliro](https://www.qliro.com) [[@kvackkvackanka](http://github.com/kvackkvackanka)]
<ide> 1. [Qoala](https://www.qoala.id) [[@gnomeria](https://github.com/gnomeria), [@qoala-engineering](https://github.com/qoala-engineering)]
<ide> 1. [Qplum](https://qplum.co) [[@manti](https://github.com/manti)]
<ide> 1. [Quantopian](https://www.quantopian.com/) [[@eronarn](http://github.com/eronarn)] | 1 |
Go | Go | avoid concurrent access to sysinfo | 54e09aa4e26c60deb74f994a08e96abea8fb857e | <ide><path>pkg/platform/architecture_windows.go
<ide> const (
<ide> ProcessorArchitectureArm = 5 // PROCESSOR_ARCHITECTURE_ARM
<ide> )
<ide>
<del>var sysinfo systeminfo
<del>
<ide> // runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
<ide> func runtimeArchitecture() (string, error) {
<add> var sysinfo systeminfo
<ide> syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
<ide> switch sysinfo.wProcessorArchitecture {
<ide> case ProcessorArchitecture64, ProcessorArchitectureIA64:
<ide> func runtimeArchitecture() (string, error) {
<ide>
<ide> // NumProcs returns the number of processors on the system
<ide> func NumProcs() uint32 {
<add> var sysinfo systeminfo
<ide> syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
<ide> return sysinfo.dwNumberOfProcessors
<ide> } | 1 |
PHP | PHP | remove useless `use` | 3a59cd24ed2be70351103a10b48e6ba114c4d545 | <ide><path>src/Form/Form.php
<ide> use Cake\Utility\Hash;
<ide> use Cake\Validation\ValidatorAwareInterface;
<ide> use Cake\Validation\ValidatorAwareTrait;
<del>use RuntimeException;
<ide>
<ide> /**
<ide> * Form abstraction used to create forms not tied to ORM backed models, | 1 |
Javascript | Javascript | remove duplicate "the" in return description | 40abdaf407457abb8cc42d0641c001e93a6be7b4 | <ide><path>src/ng/templateRequest.js
<ide> var $compileMinErr = minErr('$compile');
<ide> * @param {string} tpl The HTTP request template URL
<ide> * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
<ide> *
<del> * @return {Promise} a promise for the the HTTP response data of the given URL.
<add> * @return {Promise} a promise for the HTTP response data of the given URL.
<ide> *
<ide> * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
<ide> */ | 1 |
Text | Text | add missing comma (,) between proptypes and render | 3c56146a442f1f9226a4f3389168f8fe5b19ec55 | <ide><path>docs/docs/10.6-create-fragment.md
<ide> var Swapper = React.createClass({
<ide> rightChildren: React.PropTypes.node,
<ide>
<ide> swapped: React.PropTypes.bool
<del> }
<add> },
<ide> render: function() {
<ide> var children;
<ide> if (this.props.swapped) { | 1 |
Python | Python | add some tests for passing r and c to r_ | 0a4f3a050eca50b3ba9f5923656b052393babda4 | <ide><path>numpy/lib/tests/test_index_tricks.py
<ide> def test_2d(self):
<ide> assert_array_equal(d[:5, :], b)
<ide> assert_array_equal(d[5:, :], c)
<ide>
<add> def test_matrix(self):
<add> a = [1, 2]
<add> b = [3, 4]
<add>
<add> ab_r = np.r_['r', a, b]
<add> ab_c = np.r_['c', a, b]
<add>
<add> assert_equal(type(ab_r), np.matrix)
<add> assert_equal(type(ab_c), np.matrix)
<add>
<add> assert_equal(np.array(ab_r), [[1,2,3,4]])
<add> assert_equal(np.array(ab_c), [[1],[2],[3],[4]])
<add>
<ide> def test_matrix_builder(self):
<ide> a = np.array([1])
<ide> b = np.array([2]) | 1 |
Javascript | Javascript | add test for storing window dimension on close | d1caf26ab5094bf6ae33a43d95eb1a2495d19595 | <ide><path>spec/window-event-handler-spec.js
<ide> describe('WindowEventHandler', () => {
<ide> window.dispatchEvent(new CustomEvent('window:close'))
<ide> expect(atom.close).toHaveBeenCalled()
<ide> })
<add>
<add> it ('saves the window state', () => {
<add> spyOn(atom, 'storeWindowDimensions')
<add> window.dispatchEvent(new CustomEvent('window:close'))
<add> expect(atom.storeWindowDimensions).toHaveBeenCalled()
<add> })
<ide> )
<ide>
<add>
<add>
<ide> describe('when a link is clicked', () =>
<ide> it('opens the http/https links in an external application', () => {
<ide> const {shell} = require('electron') | 1 |
Text | Text | fix typo in object_detection's preparing_inputs.md | 7fcddd76f17fad959c83fe88166e5cb6a6d4027c | <ide><path>object_detection/g3doc/preparing_inputs.md
<ide> Extract the tar file and run the `create_pascal_tf_record` script:
<ide> tar -xvf VOCtrainval_11-May-2012.tar
<ide> python create_pascal_tf_record.py --data_dir=VOCdevkit \
<ide> --year=VOC2012 --set=train --output_path=pascal_train.record
<del>python create_pascal_tf_record.py --data_dir=/home/user/VOCdevkit \
<add>python create_pascal_tf_record.py --data_dir=VOCdevkit \
<ide> --year=VOC2012 --set=val --output_path=pascal_val.record
<ide> ```
<ide> | 1 |
Ruby | Ruby | entirelyby => 'entirely by' | 3e3e81b1fe08c46df057b2682a3049696bbfaaa4 | <ide><path>activerecord/lib/active_record/relation.rb
<ide> def references_eager_loaded_tables?
<ide> "\n" \
<ide> " Post.includes(:comments).where(\"comments.title = 'foo'\").references(:comments)\n" \
<ide> "\n" \
<del> "If you don't rely on implicit join references you can disable the feature entirely" \
<add> "If you don't rely on implicit join references you can disable the feature entirely " \
<ide> "by setting `config.active_record.disable_implicit_join_references = true`."
<ide> )
<ide> true | 1 |
PHP | PHP | fix invalid fqcn doc blocks | 8915442595eb1f324046c0a0a2e3ee4ccecd1b2c | <ide><path>src/Command/CompletionCommand.php
<ide> class CompletionCommand extends Command implements CommandCollectionAwareInterface
<ide> {
<ide> /**
<del> * @var \Cake\Command\Cake\Console\CommandCollection
<add> * @var \Cake\Console\CommandCollection
<ide> */
<ide> protected $commands;
<ide>
<ide> /**
<ide> * Set the command collection used to get completion data on.
<ide> *
<del> * @param \Cake\Command\Cake\Console\CommandCollection $commands The command collection
<add> * @param \Cake\Console\CommandCollection $commands The command collection
<ide> * @return void
<ide> */
<ide> public function setCommandCollection(CommandCollection $commands): void
<ide> public function execute(Arguments $args, ConsoleIo $io): ?int
<ide> /**
<ide> * Get the list of defined commands.
<ide> *
<del> * @param \Cake\Command\Cake\Console\Arguments $args The command arguments.
<add> * @param \Cake\Console\Arguments $args The command arguments.
<ide> * @param \Cake\Console\ConsoleIo $io The console io
<ide> * @return int
<ide> */
<ide> protected function getCommands(Arguments $args, ConsoleIo $io): int
<ide> /**
<ide> * Get the list of defined sub-commands.
<ide> *
<del> * @param \Cake\Command\Cake\Console\Arguments $args The command arguments.
<add> * @param \Cake\Console\Arguments $args The command arguments.
<ide> * @param \Cake\Console\ConsoleIo $io The console io
<ide> * @return int
<ide> */
<ide> protected function shellSubcommands(Shell $shell): array
<ide> /**
<ide> * Get the options for a command or subcommand
<ide> *
<del> * @param \Cake\Command\Cake\Console\Arguments $args The command arguments.
<add> * @param \Cake\Console\Arguments $args The command arguments.
<ide> * @param \Cake\Console\ConsoleIo $io The console io
<ide> * @return int
<ide> */ | 1 |
Ruby | Ruby | fix rubocop offences | ee98178ea54c17fbd991c6f9f8f654e7f6b86832 | <ide><path>activesupport/test/dependencies_test.rb
<ide> class RequireDependencyTest < ActiveSupport::TestCase
<ide> end
<ide>
<ide> test "require_dependency looks autoload paths up (idempotent)" do
<del> assert require_dependency("x")
<del> assert !require_dependency("x")
<add> assert require_dependency("x")
<add> assert_not require_dependency("x")
<ide> end
<ide>
<ide> test "require_dependency handles absolute paths correctly" do
<ide> class RequireDependencyTest < ActiveSupport::TestCase
<ide> end
<ide>
<ide> test "require_dependency handles absolute paths correctly (idempotent)" do
<del> assert require_dependency("#{@root_dir}/x.rb")
<del> assert !require_dependency("#{@root_dir}/x.rb")
<add> assert require_dependency("#{@root_dir}/x.rb")
<add> assert_not require_dependency("#{@root_dir}/x.rb")
<ide> end
<ide>
<ide> test "require_dependency supports arguments that respond to to_path" do
<ide> def x.to_path; "x"; end
<ide> x = Object.new
<ide> def x.to_path; "x"; end
<ide>
<del> assert require_dependency(x)
<del> assert !require_dependency(x)
<add> assert require_dependency(x)
<add> assert_not require_dependency(x)
<ide> end
<ide>
<ide> test "require_dependency fallback to Kernel#require" do
<ide> def x.to_path; "x"; end
<ide> $LOAD_PATH << dir
<ide> File.write("#{dir}/y.rb", "Y = :Y")
<ide>
<del> assert require_dependency("y")
<del> assert !require_dependency("y")
<add> assert require_dependency("y")
<add> assert_not require_dependency("y")
<ide> ensure
<ide> $LOAD_PATH.pop
<ide> Object.send(:remove_const, :Y) if Object.const_defined?(:Y) | 1 |
Python | Python | update tatoeba conversion | 7051b892671982717388dd6dfca368a90da60252 | <ide><path>src/transformers/models/marian/convert_marian_tatoeba_to_pytorch.py
<ide> # limitations under the License.
<ide>
<ide> import argparse
<add>import datetime
<add>import json
<ide> import os
<add>import re
<ide> from pathlib import Path
<del>from typing import List, Tuple
<add>from typing import Tuple
<ide>
<add>from tqdm import tqdm
<add>
<add>import yaml
<ide> from transformers.models.marian.convert_marian_to_pytorch import (
<ide> FRONT_MATTER_TEMPLATE,
<del> _parse_readme,
<del> convert_all_sentencepiece_models,
<add> convert,
<add> convert_opus_name_to_hf_name,
<add> download_and_unzip,
<ide> get_system_metadata,
<del> remove_prefix,
<del> remove_suffix,
<ide> )
<ide>
<ide>
<del>try:
<del> import pandas as pd
<del>except ImportError:
<del> pass
<del>
<ide> DEFAULT_REPO = "Tatoeba-Challenge"
<ide> DEFAULT_MODEL_DIR = os.path.join(DEFAULT_REPO, "models")
<ide> LANG_CODE_URL = "https://datahub.io/core/language-codes/r/language-codes-3b2.csv"
<ide> ISO_URL = "https://cdn-datasets.huggingface.co/language_codes/iso-639-3.csv"
<ide> ISO_PATH = "lang_code_data/iso-639-3.csv"
<ide> LANG_CODE_PATH = "lang_code_data/language-codes-3b2.csv"
<add>TATOEBA_MODELS_URL = "https://object.pouta.csc.fi/Tatoeba-MT-models"
<ide>
<ide>
<ide> class TatoebaConverter:
<ide> class TatoebaConverter:
<ide>
<ide> Steps:
<ide>
<del> 1. convert numpy state dict to hf format (same code as OPUS-MT-Train conversion).
<del> 2. rename opus model to huggingface format. This means replace each alpha3 code with an alpha2 code if a unique
<add> 1. Convert numpy state dict to hf format (same code as OPUS-MT-Train conversion).
<add> 2. Rename opus model to huggingface format. This means replace each alpha3 code with an alpha2 code if a unique
<ide> one exists. e.g. aav-eng -> aav-en, heb-eng -> he-en
<del> 3. write a model card containing the original Tatoeba-Challenge/README.md and extra info about alpha3 group
<del> members.
<add> 3. Select the best model for a particular pair, parse the yml for it and write a model card. By default the
<add> best model is the one listed first in released-model-results, but it's also possible to specify the most
<add> recent one.
<ide> """
<ide>
<ide> def __init__(self, save_dir="marian_converted"):
<ide> assert Path(DEFAULT_REPO).exists(), "need git clone [email protected]:Helsinki-NLP/Tatoeba-Challenge.git"
<del> reg = self.make_tatoeba_registry()
<del> self.download_metadata()
<del> self.registry = reg
<del> reg_df = pd.DataFrame(reg, columns=["id", "prepro", "url_model", "url_test_set"])
<del> assert reg_df.id.value_counts().max() == 1
<del> reg_df = reg_df.set_index("id")
<del> reg_df["src"] = reg_df.reset_index().id.apply(lambda x: x.split("-")[0]).values
<del> reg_df["tgt"] = reg_df.reset_index().id.apply(lambda x: x.split("-")[1]).values
<del>
<del> released_cols = [
<del> "url_base",
<del> "pair", # (ISO639-3/ISO639-5 codes),
<del> "short_pair", # (reduced codes),
<del> "chrF2_score",
<del> "bleu",
<del> "brevity_penalty",
<del> "ref_len",
<del> "src_name",
<del> "tgt_name",
<del> ]
<del>
<del> released = pd.read_csv("Tatoeba-Challenge/models/released-models.txt", sep="\t", header=None).iloc[:-1]
<del> released.columns = released_cols
<del> released["fname"] = released["url_base"].apply(
<del> lambda x: remove_suffix(remove_prefix(x, "https://object.pouta.csc.fi/Tatoeba-Challenge/opus"), ".zip")
<del> )
<del>
<del> released["2m"] = released.fname.str.startswith("2m")
<del> released["date"] = pd.to_datetime(
<del> released["fname"].apply(lambda x: remove_prefix(remove_prefix(x, "2m-"), "-"))
<del> )
<del>
<del> released["base_ext"] = released.url_base.apply(lambda x: Path(x).name)
<del> reg_df["base_ext"] = reg_df.url_model.apply(lambda x: Path(x).name)
<del>
<del> metadata_new = reg_df.reset_index().merge(released.rename(columns={"pair": "id"}), on=["base_ext", "id"])
<del>
<del> metadata_renamer = {"src": "src_alpha3", "tgt": "tgt_alpha3", "id": "long_pair", "date": "train_date"}
<del> metadata_new = metadata_new.rename(columns=metadata_renamer)
<del>
<del> metadata_new["src_alpha2"] = metadata_new.short_pair.apply(lambda x: x.split("-")[0])
<del> metadata_new["tgt_alpha2"] = metadata_new.short_pair.apply(lambda x: x.split("-")[1])
<del> DROP_COLS_BOTH = ["url_base", "base_ext", "fname"]
<del>
<del> metadata_new = metadata_new.drop(DROP_COLS_BOTH, 1)
<del> metadata_new["prefer_old"] = metadata_new.long_pair.isin([])
<del> self.metadata = metadata_new
<del> assert self.metadata.short_pair.value_counts().max() == 1, "Multiple metadata entries for a short pair"
<del> self.metadata = self.metadata.set_index("short_pair")
<del>
<del> # wget.download(LANG_CODE_URL)
<del> mapper = pd.read_csv(LANG_CODE_PATH)
<del> mapper.columns = ["a3", "a2", "ref"]
<del> self.iso_table = pd.read_csv(ISO_PATH, sep="\t").rename(columns=lambda x: x.lower())
<del> more_3_to_2 = self.iso_table.set_index("id").part1.dropna().to_dict()
<del> more_3_to_2.update(mapper.set_index("a3").a2.to_dict())
<del> self.alpha3_to_alpha2 = more_3_to_2
<add> self.download_lang_info()
<add> self.model_results = json.load(open("Tatoeba-Challenge/models/released-model-results.json"))
<add> self.alpha3_to_alpha2 = {}
<add> for line in open(ISO_PATH):
<add> parts = line.split("\t")
<add> if len(parts[0]) == 3 and len(parts[3]) == 2:
<add> self.alpha3_to_alpha2[parts[0]] = parts[3]
<add> for line in LANG_CODE_PATH:
<add> parts = line.split(",")
<add> if len(parts[0]) == 3 and len(parts[1]) == 2:
<add> self.alpha3_to_alpha2[parts[0]] = parts[1]
<ide> self.model_card_dir = Path(save_dir)
<del> self.constituents = GROUP_MEMBERS
<add> self.tag2name = {}
<add> for key, value in GROUP_MEMBERS.items():
<add> self.tag2name[key] = value[0]
<ide>
<ide> def convert_models(self, tatoeba_ids, dry_run=False):
<del> entries_to_convert = [x for x in self.registry if x[0] in tatoeba_ids]
<del> converted_paths = convert_all_sentencepiece_models(entries_to_convert, dest_dir=self.model_card_dir)
<del>
<del> for path in converted_paths:
<del> long_pair = remove_prefix(path.name, "opus-mt-").split("-") # eg. heb-eng
<del> assert len(long_pair) == 2
<del> new_p_src = self.get_two_letter_code(long_pair[0])
<del> new_p_tgt = self.get_two_letter_code(long_pair[1])
<del> hf_model_id = f"opus-mt-{new_p_src}-{new_p_tgt}"
<del> new_path = path.parent.joinpath(hf_model_id) # opus-mt-he-en
<del> os.rename(str(path), str(new_path))
<del> self.write_model_card(hf_model_id, dry_run=dry_run)
<del>
<del> def get_two_letter_code(self, three_letter_code):
<del> return self.alpha3_to_alpha2.get(three_letter_code, three_letter_code)
<add> models_to_convert = [self.parse_metadata(x) for x in tatoeba_ids]
<add> save_dir = Path("marian_ckpt")
<add> dest_dir = Path(self.model_card_dir)
<add> dest_dir.mkdir(exist_ok=True)
<add> for model in tqdm(models_to_convert): # k, prepro, download, test_set_url in tqdm(model_list):
<add> if "SentencePiece" not in model["pre-processing"]:
<add> print(f"Skipping {model['release']} because it doesn't appear to use SentencePiece")
<add> continue
<add> if not os.path.exists(save_dir / model["_name"]):
<add> download_and_unzip(f"{TATOEBA_MODELS_URL}/{model['release']}", save_dir / model["_name"])
<add> # from convert_marian_to_pytorch
<add> opus_language_groups_to_hf = convert_opus_name_to_hf_name
<add> pair_name = opus_language_groups_to_hf(model["_name"])
<add> convert(save_dir / model["_name"], dest_dir / f"opus-mt-{pair_name}")
<add> self.write_model_card(model, dry_run=dry_run)
<ide>
<ide> def expand_group_to_two_letter_codes(self, grp_name):
<del> return [self.get_two_letter_code(x) for x in self.constituents[grp_name]]
<add> return [self.alpha3_to_alpha2.get(x, x) for x in GROUP_MEMBERS[grp_name][1]]
<add>
<add> def is_group(self, code, name):
<add> return "languages" in name or len(GROUP_MEMBERS.get(code, [])) > 1
<ide>
<del> def get_tags(self, code, ref_name):
<add> def get_tags(self, code, name):
<ide> if len(code) == 2:
<del> assert "languages" not in ref_name, f"{code}: {ref_name}"
<del> return [code], False
<del> elif "languages" in ref_name or len(self.constituents.get(code, [])) > 1:
<add> assert "languages" not in name, f"{code}: {name}"
<add> return [code]
<add> elif self.is_group(code, name):
<ide> group = self.expand_group_to_two_letter_codes(code)
<ide> group.append(code)
<del> return group, True
<add> return group
<ide> else: # zho-> zh
<ide> print(f"Three letter monolingual code: {code}")
<del> return [code], False
<add> return [code]
<ide>
<del> def resolve_lang_code(self, r) -> Tuple[List[str], str, str]:
<del> """R is a row in ported"""
<del> short_pair = r.short_pair
<del> src, tgt = short_pair.split("-")
<del> src_tags, src_multilingual = self.get_tags(src, r.src_name)
<del> assert isinstance(src_tags, list)
<del> tgt_tags, tgt_multilingual = self.get_tags(tgt, r.tgt_name)
<del> assert isinstance(tgt_tags, list)
<add> def resolve_lang_code(self, src, tgt) -> Tuple[str, str]:
<add> src_tags = self.get_tags(src, self.tag2name[src])
<add> tgt_tags = self.get_tags(tgt, self.tag2name[tgt])
<add> return src_tags, tgt_tags
<ide>
<del> return dedup(src_tags + tgt_tags), src_multilingual, tgt_multilingual
<add> @staticmethod
<add> def model_type_info_from_model_name(name):
<add> info = {"_has_backtranslated_data": False}
<add> if "1m" in name:
<add> info["_data_per_pair"] = str(1e6)
<add> if "2m" in name:
<add> info["_data_per_pair"] = str(2e6)
<add> if "4m" in name:
<add> info["_data_per_pair"] = str(4e6)
<add> if "+bt" in name:
<add> info["_has_backtranslated_data"] = True
<add> if "tuned4" in name:
<add> info["_tuned"] = re.search(r"tuned4[^-]+", name).group()
<add> return info
<ide>
<del> def write_model_card(
<del> self,
<del> hf_model_id: str,
<del> repo_root=DEFAULT_REPO,
<del> dry_run=False,
<del> ) -> str:
<add> def write_model_card(self, model_dict, dry_run=False) -> str:
<ide> """
<del> Copy the most recent model's readme section from opus, and add metadata. upload command: aws s3 sync
<del> model_card_dir s3://models.huggingface.co/bert/Helsinki-NLP/ --dryrun
<add> Construct card from data parsed from YAML and the model's name. upload command: aws s3 sync model_card_dir
<add> s3://models.huggingface.co/bert/Helsinki-NLP/ --dryrun
<ide> """
<del> short_pair = remove_prefix(hf_model_id, "opus-mt-")
<del> extra_metadata = self.metadata.loc[short_pair].drop("2m")
<del> extra_metadata["short_pair"] = short_pair
<del> lang_tags, src_multilingual, tgt_multilingual = self.resolve_lang_code(extra_metadata)
<del> opus_name = f"{extra_metadata.src_alpha3}-{extra_metadata.tgt_alpha3}"
<del> # opus_name: str = self.convert_hf_name_to_opus_name(hf_model_name)
<del>
<del> assert repo_root in ("OPUS-MT-train", "Tatoeba-Challenge")
<del> opus_readme_path = Path(repo_root).joinpath("models", opus_name, "README.md")
<del> assert opus_readme_path.exists(), f"Readme file {opus_readme_path} not found"
<add> model_dir_url = f"{TATOEBA_MODELS_URL}/{model_dict['release']}"
<add> long_pair = model_dict["_name"].split("-")
<add> assert len(long_pair) == 2, f"got a translation pair {model_dict['_name']} that doesn't appear to be a pair"
<add> short_src = self.alpha3_to_alpha2.get(long_pair[0], long_pair[0])
<add> short_tgt = self.alpha3_to_alpha2.get(long_pair[1], long_pair[1])
<add> model_dict["_hf_model_id"] = f"opus-mt-{short_src}-{short_tgt}"
<ide>
<del> opus_src, opus_tgt = [x.split("+") for x in opus_name.split("-")]
<add> a3_src, a3_tgt = model_dict["_name"].split("-")
<add> # opus_src_tags, opus_tgt_tags = a3_src.split("+"), a3_tgt.split("+")
<ide>
<del> readme_url = f"https://github.com/Helsinki-NLP/{repo_root}/tree/master/models/{opus_name}/README.md"
<add> # This messy part tries to deal with language tags in multilingual models, possibly
<add> # not all having three-letter codes
<add> resolved_src_tags, resolved_tgt_tags = self.resolve_lang_code(a3_src, a3_tgt)
<add> a2_src_tags, a2_tgt_tags = [], []
<add> for tag in resolved_src_tags:
<add> if tag not in self.alpha3_to_alpha2:
<add> a2_src_tags.append(tag)
<add> for tag in resolved_tgt_tags:
<add> if tag not in self.alpha3_to_alpha2:
<add> a2_tgt_tags.append(tag)
<ide>
<del> s, t = ",".join(opus_src), ",".join(opus_tgt)
<add> lang_tags = dedup(a2_src_tags + a2_tgt_tags)
<add> src_multilingual, tgt_multilingual = (len(a2_src_tags) > 1), (len(a2_tgt_tags) > 1)
<add> s, t = ",".join(a2_src_tags), ",".join(a2_tgt_tags)
<ide>
<ide> metadata = {
<del> "hf_name": short_pair,
<add> "hf_name": model_dict["_name"],
<ide> "source_languages": s,
<ide> "target_languages": t,
<del> "opus_readme_url": readme_url,
<del> "original_repo": repo_root,
<add> "opus_readme_url": f"{model_dir_url}/README.md",
<add> "original_repo": "Tatoeba-Challenge",
<ide> "tags": ["translation"],
<ide> "languages": lang_tags,
<ide> }
<ide> lang_tags = l2front_matter(lang_tags)
<del> metadata["src_constituents"] = self.constituents[s]
<del> metadata["tgt_constituents"] = self.constituents[t]
<add>
<add> metadata["src_constituents"] = list(GROUP_MEMBERS[a3_src][1])
<add> metadata["tgt_constituents"] = list(GROUP_MEMBERS[a3_tgt][1])
<ide> metadata["src_multilingual"] = src_multilingual
<ide> metadata["tgt_multilingual"] = tgt_multilingual
<ide>
<del> metadata.update(extra_metadata)
<del> metadata.update(get_system_metadata(repo_root))
<add> backtranslated_data = ""
<add> if model_dict["_has_backtranslated_data"]:
<add> backtranslated_data = " with backtranslations"
<ide>
<del> # combine with Tatoeba markdown
<add> multilingual_data = ""
<add> if "_data_per_pair" in model_dict:
<add> multilingual_data = f"* data per pair in multilingual model: {model_dict['_data_per_pair']}\n"
<add>
<add> tuned = ""
<add> if "_tuned" in model_dict:
<add> tuned = f"* multilingual model tuned for: {model_dict['_tuned']}\n"
<add>
<add> model_base_filename = model_dict["release"].split("/")[-1]
<add> download = f"* download original weights: [{model_base_filename}]({model_dir_url}/{model_dict['release']})\n"
<add>
<add> langtoken = ""
<add> if tgt_multilingual:
<add> langtoken = (
<add> "* a sentence-initial language token is required in the form of >>id<<"
<add> "(id = valid, usually three-letter target language ID)\n"
<add> )
<add>
<add> metadata.update(get_system_metadata(DEFAULT_REPO))
<add>
<add> scorestable = ""
<add> for k, v in model_dict.items():
<add> if "scores" in k:
<add> this_score_table = f"* {k}\n|Test set|score|\n|---|---|\n"
<add> pairs = sorted(v.items(), key=lambda x: x[1], reverse=True)
<add> for pair in pairs:
<add> this_score_table += f"|{pair[0]}|{pair[1]}|\n"
<add> scorestable += this_score_table
<add>
<add> datainfo = ""
<add> if "training-data" in model_dict:
<add> datainfo += "* Training data: \n"
<add> for k, v in model_dict["training-data"].items():
<add> datainfo += f" * {str(k)}: {str(v)}\n"
<add> if "validation-data" in model_dict:
<add> datainfo += "* Validation data: \n"
<add> for k, v in model_dict["validation-data"].items():
<add> datainfo += f" * {str(k)}: {str(v)}\n"
<add> if "test-data" in model_dict:
<add> datainfo += "* Test data: \n"
<add> for k, v in model_dict["test-data"].items():
<add> datainfo += f" * {str(k)}: {str(v)}\n"
<ide>
<del> extra_markdown = f"### {short_pair}\n\n* source group: {metadata['src_name']} \n* target group: {metadata['tgt_name']} \n* OPUS readme: [{opus_name}]({readme_url})\n"
<add> testsetfilename = model_dict["release"].replace(".zip", ".test.txt")
<add> testscoresfilename = model_dict["release"].replace(".zip", ".eval.txt")
<add> testset = f"* test set translations file: [test.txt]({model_dir_url}/{testsetfilename})\n"
<add> testscores = f"* test set scores file: [eval.txt]({model_dir_url}/{testscoresfilename})\n"
<ide>
<del> content = opus_readme_path.open().read()
<del> content = content.split("\n# ")[-1] # Get the lowest level 1 header in the README -- the most recent model.
<del> splat = content.split("*")[2:]
<add> # combine with Tatoeba markdown
<add> readme_url = f"{TATOEBA_MODELS_URL}/{model_dict['_name']}/README.md"
<add> extra_markdown = f"""
<add>### {model_dict['_name']}
<ide>
<del> content = "*".join(splat)
<del> # BETTER FRONT MATTER LOGIC
<add>* source language name: {self.tag2name[a3_src]}
<add>* target language name: {self.tag2name[a3_tgt]}
<add>* OPUS readme: [README.md]({readme_url})
<add>"""
<ide>
<ide> content = (
<del> FRONT_MATTER_TEMPLATE.format(lang_tags)
<del> + extra_markdown
<del> + "\n* "
<del> + content.replace("download", "download original " "weights")
<add> f"""
<add>* model: {model_dict['modeltype']}
<add>* source language code{src_multilingual*'s'}: {', '.join(a2_src_tags)}
<add>* target language code{tgt_multilingual*'s'}: {', '.join(a2_tgt_tags)}
<add>* dataset: opus {backtranslated_data}
<add>* release date: {model_dict['release-date']}
<add>* pre-processing: {model_dict['pre-processing']}
<add>"""
<add> + multilingual_data
<add> + tuned
<add> + download
<add> + langtoken
<add> + datainfo
<add> + testset
<add> + testscores
<add> + scorestable
<ide> )
<ide>
<del> items = "\n\n".join([f"- {k}: {v}" for k, v in metadata.items()])
<add> content = FRONT_MATTER_TEMPLATE.format(lang_tags) + extra_markdown + content
<add>
<add> items = "\n".join([f"* {k}: {v}" for k, v in metadata.items()])
<ide> sec3 = "\n### System Info: \n" + items
<ide> content += sec3
<ide> if dry_run:
<del> return content, metadata
<del> sub_dir = self.model_card_dir / hf_model_id
<add> print("CONTENT:")
<add> print(content)
<add> print("METADATA:")
<add> print(metadata)
<add> return
<add> sub_dir = self.model_card_dir / model_dict["_hf_model_id"]
<ide> sub_dir.mkdir(exist_ok=True)
<ide> dest = sub_dir / "README.md"
<ide> dest.open("w").write(content)
<del> pd.Series(metadata).to_json(sub_dir / "metadata.json")
<del> return content, metadata
<add> for k, v in metadata.items():
<add> if isinstance(v, datetime.date):
<add> metadata[k] = datetime.datetime.strftime(v, "%Y-%m-%d")
<add> with open(sub_dir / "metadata.json", "w", encoding="utf-8") as writeobj:
<add> json.dump(metadata, writeobj)
<ide>
<del> def download_metadata(self):
<add> def download_lang_info(self):
<ide> Path(LANG_CODE_PATH).parent.mkdir(exist_ok=True)
<ide> import wget
<ide>
<ide> def download_metadata(self):
<ide> if not os.path.exists(LANG_CODE_PATH):
<ide> wget.download(LANG_CODE_URL, LANG_CODE_PATH)
<ide>
<del> @staticmethod
<del> def make_tatoeba_registry(repo_path=DEFAULT_MODEL_DIR):
<del> if not (Path(repo_path) / "zho-eng" / "README.md").exists():
<del> raise ValueError(
<del> f"repo_path:{repo_path} does not exist: "
<del> "You must run: git clone [email protected]:Helsinki-NLP/Tatoeba-Challenge.git before calling."
<add> def parse_metadata(self, model_name, repo_path=DEFAULT_MODEL_DIR, method="best"):
<add> p = Path(repo_path) / model_name
<add>
<add> def url_to_name(url):
<add> return url.split("/")[-1].split(".")[0]
<add>
<add> if model_name not in self.model_results:
<add> # This is not a language pair, so model results are ambiguous, go by newest
<add> method = "newest"
<add>
<add> if method == "best":
<add> # Sort by how early they appear in released-models-results
<add> results = [url_to_name(model["download"]) for model in self.model_results[model_name]]
<add> ymls = [f for f in os.listdir(p) if f.endswith(".yml") and f[:-4] in results]
<add> ymls.sort(key=lambda x: results.index(x[:-4]))
<add> metadata = yaml.safe_load(open(p / ymls[0]))
<add> metadata.update(self.model_type_info_from_model_name(ymls[0][:-4]))
<add> elif method == "newest":
<add> ymls = [f for f in os.listdir(p) if f.endswith(".yml")]
<add> # Sort by date
<add> ymls.sort(
<add> key=lambda x: datetime.datetime.strptime(re.search(r"\d\d\d\d-\d\d?-\d\d?", x).group(), "%Y-%m-%d")
<ide> )
<del> results = {}
<del> for p in Path(repo_path).iterdir():
<del> if len(p.name) != 7:
<del> continue
<del> lns = list(open(p / "README.md").readlines())
<del> results[p.name] = _parse_readme(lns)
<del> return [(k, v["pre-processing"], v["download"], v["download"][:-4] + ".test.txt") for k, v in results.items()]
<add> metadata = yaml.safe_load(open(p / ymls[-1]))
<add> metadata.update(self.model_type_info_from_model_name(ymls[-1][:-4]))
<add> else:
<add> raise NotImplementedError(f"Don't know argument method='{method}' to parse_metadata()")
<add> metadata["_name"] = model_name
<add> return metadata
<ide>
<ide>
<ide> GROUP_MEMBERS = {
<ide> def dedup(lst):
<ide> """Preservers order"""
<ide> new_lst = []
<ide> for item in lst:
<del> if not item:
<del> continue
<del> elif item in new_lst:
<add> if not item or item in new_lst:
<ide> continue
<ide> else:
<ide> new_lst.append(item) | 1 |
Javascript | Javascript | remove var in rntester | a21b8b736054ebfd80bd9d0497b04f296174fe65 | <ide><path>RNTester/js/ARTExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {ART, Platform, View} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {ART, Platform, View} = ReactNative;
<ide>
<ide> const {Surface, Path, Group, Transform, Shape} = ART;
<ide>
<del>var scale = Platform.isTV ? 4 : 1;
<add>const scale = Platform.isTV ? 4 : 1;
<ide>
<ide> class ARTExample extends React.Component<{}> {
<ide> render() {
<ide><path>RNTester/js/AccessibilityAndroidExample.android.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {
<ide> AccessibilityInfo,
<ide> StyleSheet,
<ide> Text,
<ide> var {
<ide> TouchableWithoutFeedback,
<ide> } = ReactNative;
<ide>
<del>var RNTesterBlock = require('./RNTesterBlock');
<del>var RNTesterPage = require('./RNTesterPage');
<add>const RNTesterBlock = require('./RNTesterBlock');
<add>const RNTesterPage = require('./RNTesterPage');
<ide>
<del>var importantForAccessibilityValues = [
<add>const importantForAccessibilityValues = [
<ide> 'auto',
<ide> 'yes',
<ide> 'no',
<ide> class AccessibilityAndroidExample extends React.Component {
<ide> }
<ide> }
<ide>
<del>var styles = StyleSheet.create({
<add>const styles = StyleSheet.create({
<ide> embedded: {
<ide> backgroundColor: 'yellow',
<ide> padding: 10,
<ide><path>RNTester/js/AccessibilityIOSExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {AccessibilityInfo, Text, View, TouchableOpacity} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {AccessibilityInfo, Text, View, TouchableOpacity} = ReactNative;
<ide>
<ide> class AccessibilityIOSExample extends React.Component<{}> {
<ide> render() {
<ide><path>RNTester/js/ActionSheetIOSExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {ActionSheetIOS, StyleSheet, takeSnapshot, Text, View} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {ActionSheetIOS, StyleSheet, takeSnapshot, Text, View} = ReactNative;
<ide>
<del>var BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
<del>var DESTRUCTIVE_INDEX = 3;
<del>var CANCEL_INDEX = 4;
<add>const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
<add>const DESTRUCTIVE_INDEX = 3;
<add>const CANCEL_INDEX = 4;
<ide>
<ide> class ActionSheetExample extends React.Component<{}, $FlowFixMeState> {
<ide> state = {
<ide> class ShareActionSheetExample extends React.Component<
<ide> },
<ide> error => alert(error),
<ide> (completed, method) => {
<del> var text;
<add> let text;
<ide> if (completed) {
<ide> text = `Shared via ${method}`;
<ide> } else {
<ide> class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
<ide> },
<ide> error => alert(error),
<ide> (completed, method) => {
<del> var text;
<add> let text;
<ide> if (completed) {
<ide> text = `Shared via ${method}`;
<ide> } else {
<ide> class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
<ide> };
<ide> }
<ide>
<del>var style = StyleSheet.create({
<add>const style = StyleSheet.create({
<ide> button: {
<ide> marginBottom: 10,
<ide> fontWeight: '500',
<ide><path>RNTester/js/AlertExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative;
<ide>
<del>var RNTesterBlock = require('./RNTesterBlock');
<add>const RNTesterBlock = require('./RNTesterBlock');
<ide>
<ide> // corporate ipsum > lorem ipsum
<del>var alertMessage =
<add>const alertMessage =
<ide> 'Credibly reintermediate next-generation potentialities after goal-oriented ' +
<ide> 'catalysts for change. Dynamically revolutionize.';
<ide>
<ide> class AlertExample extends React.Component {
<ide> }
<ide> }
<ide>
<del>var styles = StyleSheet.create({
<add>const styles = StyleSheet.create({
<ide> wrapper: {
<ide> borderRadius: 5,
<ide> marginBottom: 5,
<ide><path>RNTester/js/AlertIOSExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {StyleSheet, View, Text, TouchableHighlight, AlertIOS} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {StyleSheet, View, Text, TouchableHighlight, AlertIOS} = ReactNative;
<ide>
<del>var {SimpleAlertExampleBlock} = require('./AlertExample');
<add>const {SimpleAlertExampleBlock} = require('./AlertExample');
<ide>
<ide> exports.framework = 'React';
<ide> exports.title = 'AlertIOS';
<ide> class PromptOptions extends React.Component<$FlowFixMeProps, any> {
<ide> }
<ide> }
<ide>
<del>var styles = StyleSheet.create({
<add>const styles = StyleSheet.create({
<ide> wrapper: {
<ide> borderRadius: 5,
<ide> marginBottom: 5,
<ide><path>RNTester/js/AnimatedExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {Animated, Easing, StyleSheet, Text, View} = ReactNative;
<del>var RNTesterButton = require('./RNTesterButton');
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {Animated, Easing, StyleSheet, Text, View} = ReactNative;
<add>const RNTesterButton = require('./RNTesterButton');
<ide>
<ide> exports.framework = 'React';
<ide> exports.title = 'Animated - Examples';
<ide> exports.examples = [
<ide> <View>
<ide> <RNTesterButton
<ide> onPress={() => {
<del> var timing = Animated.timing;
<add> const timing = Animated.timing;
<ide> Animated.sequence([
<ide> // One after the other
<ide> timing(this.anims[0], {
<ide> exports.examples = [
<ide> },
<ide> ];
<ide>
<del>var styles = StyleSheet.create({
<add>const styles = StyleSheet.create({
<ide> content: {
<ide> backgroundColor: 'deepskyblue',
<ide> borderWidth: 1,
<ide><path>RNTester/js/AppStateExample.js
<ide> class AppStateSubscription extends React.Component<
<ide> };
<ide>
<ide> _handleAppStateChange = appState => {
<del> var previousAppStates = this.state.previousAppStates.slice();
<add> const previousAppStates = this.state.previousAppStates.slice();
<ide> previousAppStates.push(this.state.appState);
<ide> this.setState({
<ide> appState,
<ide><path>RNTester/js/AssetScaledImageExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {Image, StyleSheet, View, ScrollView} = ReactNative;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {Image, StyleSheet, View, ScrollView} = ReactNative;
<ide>
<ide> import type {PhotoIdentifier} from 'CameraRoll';
<ide>
<ide> class AssetScaledImageExample extends React.Component<Props, State> {
<ide> };
<ide>
<ide> render() {
<del> var image = this.state.asset.node.image;
<add> const image = this.state.asset.node.image;
<ide> return (
<ide> <ScrollView>
<ide> <View style={styles.row}>
<ide> class AssetScaledImageExample extends React.Component<Props, State> {
<ide> }
<ide> }
<ide>
<del>var styles = StyleSheet.create({
<add>const styles = StyleSheet.create({
<ide> row: {
<ide> padding: 5,
<ide> flex: 1,
<ide><path>RNTester/js/AsyncStorageExample.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {AsyncStorage, PickerIOS, Text, View} = ReactNative;
<del>var PickerItemIOS = PickerIOS.Item;
<add>const React = require('react');
<add>const ReactNative = require('react-native');
<add>const {AsyncStorage, PickerIOS, Text, View} = ReactNative;
<add>const PickerItemIOS = PickerIOS.Item;
<ide>
<del>var STORAGE_KEY = '@AsyncStorageExample:key';
<del>var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
<add>const STORAGE_KEY = '@AsyncStorageExample:key';
<add>const COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
<ide>
<ide> class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
<ide> state = {
<ide> class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
<ide>
<ide> _loadInitialState = async () => {
<ide> try {
<del> var value = await AsyncStorage.getItem(STORAGE_KEY);
<add> const value = await AsyncStorage.getItem(STORAGE_KEY);
<ide> if (value !== null) {
<ide> this.setState({selectedValue: value});
<ide> this._appendMessage('Recovered selection from disk: ' + value);
<ide> class BasicStorageExample extends React.Component<{}, $FlowFixMeState> {
<ide> };
<ide>
<ide> render() {
<del> var color = this.state.selectedValue;
<add> const color = this.state.selectedValue;
<ide> return (
<ide> <View>
<ide> <PickerIOS selectedValue={color} onValueChange={this._onValueChange}> | 10 |
Javascript | Javascript | remove the first empty character of charset | 2e71f798655837992b6bff4c12c3818829110390 | <ide><path>fonts.js
<ide> var Font = (function () {
<ide>
<ide> var charset = properties.charset;
<ide> if (charset && charset.length) {
<del> // XXX why is the first character equal to ''?
<add> log(charset);
<ide> for (var i = 1; i < charset.length; i++) {
<ide> var position = getUnicodeRangeFor(GlyphsUnicode[charset[i]]);
<ide> if (position < 32) {
<ide><path>pdf.js
<ide> var CanvasGraphics = (function() {
<ide> if (charset) {
<ide> assertWellFormed(IsString(charset), "invalid charset");
<ide> charset = charset.split("/");
<add> charset.shift();
<ide> }
<ide> } else if (IsName(encoding)) {
<ide> var encoding = Encodings[encoding.name];
<ide> var CanvasGraphics = (function() {
<ide> type: subType.name,
<ide> encoding: encodingMap,
<ide> charset: charset,
<add> firstChar: fontDict.get("FirstChar"),
<add> lastChar: fontDict.get("LastChar"),
<ide> bbox: descriptor.get("FontBBox"),
<ide> ascent: descriptor.get("Ascent"),
<ide> descent: descriptor.get("Descent"), | 2 |
Java | Java | resolve resourceurlprovider from current request | 2baceac5ff03489628e058c76a35306519e6cbb2 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/AppCacheManifestTransformer.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> private Mono<LineOutput> processLine(LineInfo info, ServerWebExchange exchange,
<ide> return Mono.just(new LineOutput(info.getLine(), null));
<ide> }
<ide>
<del> String link = toAbsolutePath(info.getLine(), exchange.getRequest());
<add> String link = toAbsolutePath(info.getLine(), exchange);
<ide> Mono<String> pathMono = resolveUrlPath(link, exchange, resource, chain)
<ide> .doOnNext(path -> {
<ide> if (logger.isTraceEnabled()) {
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/CssLinkResourceTransformer.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public Mono<Resource> transform(ServerWebExchange exchange, Resource resource,
<ide> .concatMap(segment -> {
<ide> String segmentContent = segment.getContent(fullContent);
<ide> if (segment.isLink() && !hasScheme(segmentContent)) {
<del> String link = toAbsolutePath(segmentContent, exchange.getRequest());
<add> String link = toAbsolutePath(segmentContent, exchange);
<ide> return resolveUrlPath(link, exchange, newResource, transformerChain)
<ide> .defaultIfEmpty(segmentContent);
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceTransformerSupport.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> protected Mono<String> resolveUrlPath(String resourcePath, ServerWebExchange exc
<ide> * The resulting path is also cleaned from sequences like "path/..".
<ide> *
<ide> * @param path the relative path to transform
<del> * @param request the referer request
<add> * @param exchange the current exchange
<ide> * @return the absolute request path for the given resource path
<ide> */
<del> protected String toAbsolutePath(String path, ServerHttpRequest request) {
<del> String requestPath = request.getURI().getPath();
<add> protected String toAbsolutePath(String path, ServerWebExchange exchange) {
<add> String requestPath = exchange.getRequest().getURI().getPath();
<ide> String absolutePath = StringUtils.applyRelativePath(requestPath, path);
<ide> return StringUtils.cleanPath(absolutePath);
<ide> }
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceTransformerSupport.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public abstract class ResourceTransformerSupport implements ResourceTransformer
<ide> /**
<ide> * Configure a {@link ResourceUrlProvider} to use when resolving the public
<ide> * URL of links in a transformed resource (e.g. import links in a CSS file).
<del> * This is required only for links expressed as full paths, i.e. including
<del> * context and servlet path, and not for relative links.
<del> * <p>By default this property is not set. In that case if a
<del> * {@code ResourceUrlProvider} is needed an attempt is made to find the
<del> * {@code ResourceUrlProvider} exposed through the
<del> * {@link org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor
<del> * ResourceUrlProviderExposingInterceptor} (configured by default in the MVC
<del> * Java config and XML namespace). Therefore explicitly configuring this
<del> * property should not be needed in most cases.
<add> * This is required only for links expressed as full paths and not for
<add> * relative links.
<ide> * @param resourceUrlProvider the URL provider to use
<ide> */
<ide> public void setResourceUrlProvider(ResourceUrlProvider resourceUrlProvider) {
<ide> protected String resolveUrlPath(String resourcePath, HttpServletRequest request,
<ide> * @return the absolute request path for the given resource path
<ide> */
<ide> protected String toAbsolutePath(String path, HttpServletRequest request) {
<del> String requestPath = this.getResourceUrlProvider().getUrlPathHelper().getRequestUri(request);
<add> String requestPath = this.findResourceUrlProvider(request).getUrlPathHelper().getRequestUri(request);
<ide> String absolutePath = StringUtils.applyRelativePath(requestPath, path);
<ide> return StringUtils.cleanPath(absolutePath);
<ide> } | 4 |
PHP | PHP | use local file loading method in fileloader | 1324e78a037f236f33d6c88787a5e3b1c4fb912b | <ide><path>src/Illuminate/Config/FileLoader.php
<ide> public function load($environment, $group, $namespace = null)
<ide>
<ide> if ($this->files->exists($file))
<ide> {
<del> $items = $this->files->getRequire($file);
<add> $items = $this->getRequire($file);
<ide> }
<ide>
<ide> // Finally we're ready to check for the environment specific configuration
<ide> public function load($environment, $group, $namespace = null)
<ide> */
<ide> protected function mergeEnvironment(array $items, $file)
<ide> {
<del> return array_replace_recursive($items, $this->files->getRequire($file));
<add> return array_replace_recursive($items, $this->getRequire($file));
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | add 3.0.0-beta.5 to changelog | afedeaae2e7502c6b696d2e433979307c9f4542e | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### 3.0.0-beta.5 (January 29, 2018)
<add>
<add>- [#16179](https://github.com/emberjs/ember.js/pull/16179) [BUGFIX] Fix a few bugs in the caching ArrayProxy implementation
<add>
<ide> ### 3.0.0-beta.4 (January 25, 2018)
<ide>
<ide> - [#16160](https://github.com/emberjs/ember.js/pull/16160) [BUGFIX] Remove humanize() call from generated test descriptions | 1 |
Text | Text | add note for platform specific flags `fs.open()` | ae991e757732aad13af1a4b2ecf66840937f04e1 | <ide><path>doc/api/fs.md
<ide> On Linux, positional writes don't work when the file is opened in append mode.
<ide> The kernel ignores the position argument and always appends the data to
<ide> the end of the file.
<ide>
<add>_Note: The behavior of `fs.open()` is platform specific for some flags. As such,
<add>opening a directory on OS X and Linux with the `'a+'` flag - see example below -
<add>will return an error. Whereas on Windows and FreeBSD a file descriptor will be
<add>returned._
<add>
<add>```js
<add>// OS X and Linux
<add>fs.open('<directory>', 'a+', (err, fd) => {
<add> // => [Error: EISDIR: illegal operation on a directory, open <directory>]
<add>})
<add>
<add>// Windows and FreeBSD
<add>fs.open('<directory>', 'a+', (err, fd) => {
<add> // => null, <fd>
<add>})
<add>```
<add>
<ide> ## fs.openSync(path, flags[, mode])
<ide>
<ide> * `path` {String | Buffer} | 1 |
Javascript | Javascript | use ember.logger instead of console.log | 7349345dee477bba864854454c948b0ff6dccc30 | <ide><path>packages/ember-views/lib/views/states.js
<ide> Ember.View.RenderStateManager = Ember.StateManager.extend({
<ide> // and we should still raise an exception in that
<ide> // case.
<ide> if (typeof action === 'function') {
<del> if (log) { console.log(fmt("STATEMANAGER: Sending event '%@' to state %@.", [event, get(currentState, 'path')])); }
<add> if (log) { Ember.Logger.log(fmt("STATEMANAGER: Sending event '%@' to state %@.", [event, get(currentState, 'path')])); }
<ide>
<ide> // remove event and currentState from the args
<ide> // and move `this` to the first argument position. | 1 |
Javascript | Javascript | ignore devdependencies when generating template. | 5219585ef90f7a9ade66fdc0d9362a5706dfcc8b | <ide><path>local-cli/generator/templates.js
<ide> function createFromRemoteTemplate(
<ide> // only for publishing the template to npm.
<ide> // We want to ignore this dummy file, otherwise it would overwrite
<ide> // our project's package.json file.
<del> ignorePaths: ['package.json', 'dependencies.json'],
<add> ignorePaths: ['package.json', 'dependencies.json','devDependencies.json'],
<ide> });
<ide> installTemplateDependencies(templatePath, yarnVersion);
<ide> installTemplateDevDependencies(templatePath, yarnVersion); | 1 |
Ruby | Ruby | remove method named "hash" | a2be6ce3eb94516a57c07c98f3cb19502b05cff1 | <ide><path>actionview/lib/action_view/testing/resolvers.rb
<ide> module ActionView #:nodoc:
<ide> # useful for testing extensions that have no way of knowing what the file
<ide> # system will look like at runtime.
<ide> class FixtureResolver < PathResolver
<del> attr_reader :hash
<del>
<ide> def initialize(hash = {}, pattern = nil)
<ide> super(pattern)
<ide> @hash = hash
<ide> end
<ide>
<add> def data
<add> @hash
<add> end
<add>
<ide> def to_s
<ide> @hash.keys.join(", ")
<ide> end
<ide><path>actionview/test/template/lookup_context_test.rb
<ide> def teardown
<ide>
<ide> # Now we are going to change the template, but it won't change the returned template
<ide> # since we will hit the cache.
<del> @lookup_context.view_paths.first.hash["test/_foo.erb"] = "Bar"
<add> @lookup_context.view_paths.first.data["test/_foo.erb"] = "Bar"
<ide> template = @lookup_context.find("foo", %w(test), true)
<ide> assert_equal "Foo", template.source
<ide>
<ide> def setup
<ide>
<ide> # Now we are going to change the template, but it won't change the returned template
<ide> # since the timestamp is the same.
<del> @resolver.hash["test/_foo.erb"][0] = "Bar"
<add> @resolver.data["test/_foo.erb"][0] = "Bar"
<ide> template = @lookup_context.find("foo", %w(test), true)
<ide> assert_equal "Foo", template.source
<ide>
<ide> # Now update the timestamp.
<del> @resolver.hash["test/_foo.erb"][1] = Time.now.utc
<add> @resolver.data["test/_foo.erb"][1] = Time.now.utc
<ide> template = @lookup_context.find("foo", %w(test), true)
<ide> assert_equal "Bar", template.source
<ide> end
<ide> def setup
<ide> template = @lookup_context.find("foo", %w(test), true)
<ide> assert_equal "Foo", template.source
<ide>
<del> @resolver.hash.clear
<add> @resolver.data.clear
<ide> assert_raise ActionView::MissingTemplate do
<ide> @lookup_context.find("foo", %w(test), true)
<ide> end
<ide> def setup
<ide>
<ide> test "if no template was cached in the first lookup, retrieval should work in the second call" do
<ide> ActionView::Resolver.stub(:caching?, false) do
<del> @resolver.hash.clear
<add> @resolver.data.clear
<ide> assert_raise ActionView::MissingTemplate do
<ide> @lookup_context.find("foo", %w(test), true)
<ide> end
<ide>
<del> @resolver.hash["test/_foo.erb"] = ["Foo", Time.utc(2000)]
<add> @resolver.data["test/_foo.erb"] = ["Foo", Time.utc(2000)]
<ide> template = @lookup_context.find("foo", %w(test), true)
<ide> assert_equal "Foo", template.source
<ide> end | 2 |
Text | Text | fix broken links in pr template | 9a521cb3ad223f4f21e7f616138ec9eb5466fcb6 | <ide><path>.github/PULL_REQUEST_TEMPLATE.md
<del><!-- General PR submission guidelines https://github.com/angular/angular.js/CONTRIBUTING.md#submit-pr -->
<add><!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
<ide> **What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
<ide>
<ide>
<ide>
<ide>
<ide> **Please check if the PR fulfills these requirements**
<del>- [ ] The commit message follows our [guidelines](../DEVELOPERS.md#commits)
<del>- [ ] Fix/Feature: [Docs](../DEVELOPERS.md#documentation) have been added/updated
<add>- [ ] The commit message follows our [guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits)
<add>- [ ] Fix/Feature: [Docs](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#documentation) have been added/updated
<ide> - [ ] Fix/Feature: Tests have been added; existing tests pass
<ide>
<ide> **Other information**: | 1 |
Python | Python | fix textcat test | 31ed64e9b0ba6d2be87d3627b7417335494fa60d | <ide><path>spacy/tests/test_textcat.py
<ide>
<ide>
<ide> def test_textcat_learns_multilabel():
<del> random.seed(1)
<del> numpy.random.seed(1)
<add> random.seed(5)
<add> numpy.random.seed(5)
<ide> docs = []
<ide> nlp = English()
<ide> vocab = nlp.vocab | 1 |
Python | Python | add sqlite default connection | c61a5d8d81422c0419dbfa22c5debd4845661523 | <ide><path>airflow/utils.py
<ide> def initdb():
<ide> port=10001))
<ide> session.commit()
<ide>
<add> conn = session.query(C).filter(C.conn_id == 'sqlite_default').first()
<add> if not conn:
<add> home = conf.get('core', 'AIRFLOW_HOME')
<add> session.add(
<add> models.Connection(
<add> conn_id='sqlite_default', conn_type='sqlite',
<add> host='{}/sqlite_default.db'.format(home)))
<add> session.commit()
<add>
<ide> # Known event types
<ide> KET = models.KnownEventType
<ide> if not session.query(KET).filter(KET.know_event_type == 'Holiday').first(): | 1 |
Text | Text | add v3.1.2 and v3.1.1 to changelog | 53a0166abc45632c78c7d065cc619873ac59513b | <ide><path>CHANGELOG.md
<ide> - [#16462](https://github.com/emberjs/ember.js/pull/16462) [CLEANUP] Remove deprecated `MODEL_FACTORY_INJECTIONS`
<ide> - [emberjs/rfcs#286](https://github.com/emberjs/rfcs/blob/master/text/0286-block-let-template-helper.md) [FEATURE] Enabled block `let` handlebars helper by default.
<ide>
<add>### v3.1.2 (May 7, 2018)
<add>- [#16600](https://github.com/emberjs/ember.js/pull/16600) [BUGFIX] Fix SimpleHelper memory leak
<add>- [#16605](https://github.com/emberjs/ember.js/pull/16605) [BUGFIX] Use resetCache on container destroy.
<add>- [182fc3](https://github.com/emberjs/ember.js/commit/182fc315664e8b4847f03133cc01e38767cad41e) [BUGFIX] Update glimmer-vm to ensure arguments are properly garbage collected.
<add>- [#16281](https://github.com/emberjs/ember.js/pull/16281) [BUGFIX] Ensure warning from `{{#link-to` RE: loading state does not throw an assertion.
<add>
<ide> ### v3.1.1 (April 23, 2018)
<ide> - [#16559](https://github.com/emberjs/ember.js/pull/16559) [BUGFIX] Fix property normalization, Update glimmer-vm to 0.34.0
<ide> - [#16493](https://github.com/emberjs/ember.js/pull/16493) [BUGFIX] Ensure proxies have access to `getOwner(this)`. | 1 |
Mixed | Javascript | support dot(s) in object keys | a4114e84d9f1f66c3e7fa76d5d1790fa64392f9a | <ide><path>docs/general/data-structures.md
<ide> options: {
<ide> }
<ide> ```
<ide>
<add>If the key contains a dot, it needs to be escaped with a double slash:
<add>
<add>```javascript
<add>type: 'line',
<add>data: {
<add> datasets: [{
<add> data: [{ 'data.key': 'one', 'data.value': 20 }, { 'data.key': 'two', 'data.value': 30 }]
<add> }]
<add>},
<add>options: {
<add> parsing: {
<add> xAxisKey: 'data\\.key',
<add> yAxisKey: 'data\\.value'
<add> }
<add>}
<add>```
<add>
<ide> :::warning
<ide> When using object notation in a radar chart you still need a labels array with labels for the chart to show correctly.
<ide> :::
<ide>
<del>
<ide> ## Object
<ide>
<ide> ```javascript
<ide><path>src/helpers/helpers.core.js
<ide> export function _deprecated(scope, value, previous, current) {
<ide> }
<ide> }
<ide>
<del>const emptyString = '';
<del>const dot = '.';
<del>function indexOfDotOrLength(key, start) {
<del> const idx = key.indexOf(dot, start);
<del> return idx === -1 ? key.length : idx;
<del>}
<add>// resolveObjectKey resolver cache
<add>const keyResolvers = {
<add> // Chart.helpers.core resolveObjectKey should resolve empty key to root object
<add> '': v => v,
<add> // default resolvers
<add> x: o => o.x,
<add> y: o => o.y
<add>};
<ide>
<ide> export function resolveObjectKey(obj, key) {
<del> if (key === emptyString) {
<add> const resolver = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));
<add> return resolver(obj);
<add>}
<add>
<add>function _getKeyResolver(key) {
<add> const keys = _splitKey(key);
<add> return obj => {
<add> for (const k of keys) {
<add> if (k === '') {
<add> // For backward compatibility:
<add> // Chart.helpers.core resolveObjectKey should break at empty key
<add> break;
<add> }
<add> obj = obj && obj[k];
<add> }
<ide> return obj;
<add> };
<add>}
<add>
<add>/**
<add> * @private
<add> */
<add>export function _splitKey(key) {
<add> const parts = key.split('.');
<add> const keys = [];
<add> let tmp = '';
<add> for (const part of parts) {
<add> tmp += part;
<add> if (tmp.endsWith('\\')) {
<add> tmp = tmp.slice(0, -1) + '.';
<add> } else {
<add> keys.push(tmp);
<add> tmp = '';
<add> }
<ide> }
<del> let pos = 0;
<del> let idx = indexOfDotOrLength(key, pos);
<del> while (obj && idx > pos) {
<del> obj = obj[key.slice(pos, idx)];
<del> pos = idx + 1;
<del> idx = indexOfDotOrLength(key, pos);
<del> }
<del> return obj;
<add> return keys;
<ide> }
<ide>
<ide> /**
<ide><path>test/specs/helpers.core.tests.js
<ide> describe('Chart.helpers.core', function() {
<ide> expect(() => helpers.resolveObjectKey({}, true)).toThrow();
<ide> expect(() => helpers.resolveObjectKey({}, 1)).toThrow();
<ide> });
<add> it('should allow escaping dot symbol', function() {
<add> expect(helpers.resolveObjectKey({'test.dot': 10}, 'test\\.dot')).toEqual(10);
<add> expect(helpers.resolveObjectKey({test: {dot: 10}}, 'test\\.dot')).toEqual(undefined);
<add> });
<add> it('should allow nested keys with a dot', function() {
<add> expect(helpers.resolveObjectKey({
<add> a: {
<add> 'bb.ccc': 'works',
<add> bb: {
<add> ccc: 'fails'
<add> }
<add> }
<add> }, 'a.bb\\.ccc')).toEqual('works');
<add> });
<add>
<add> });
<add>
<add> describe('_splitKey', function() {
<add> it('should return array with one entry for string without a dot', function() {
<add> expect(helpers._splitKey('')).toEqual(['']);
<add> expect(helpers._splitKey('test')).toEqual(['test']);
<add> const asciiWithoutDot = ' !"#$%&\'()*+,-/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
<add> expect(helpers._splitKey(asciiWithoutDot)).toEqual([asciiWithoutDot]);
<add> });
<add>
<add> it('should split on dot', function() {
<add> expect(helpers._splitKey('test1.test2')).toEqual(['test1', 'test2']);
<add> expect(helpers._splitKey('a.b.c')).toEqual(['a', 'b', 'c']);
<add> expect(helpers._splitKey('a.b.')).toEqual(['a', 'b', '']);
<add> expect(helpers._splitKey('a..c')).toEqual(['a', '', 'c']);
<add> });
<add>
<add> it('should preserve escaped dot', function() {
<add> expect(helpers._splitKey('test1\\.test2')).toEqual(['test1.test2']);
<add> expect(helpers._splitKey('a\\.b.c')).toEqual(['a.b', 'c']);
<add> expect(helpers._splitKey('a.b\\.c')).toEqual(['a', 'b.c']);
<add> expect(helpers._splitKey('a.\\.c')).toEqual(['a', '.c']);
<add> });
<ide> });
<ide>
<ide> describe('setsEqual', function() { | 3 |
Javascript | Javascript | remove superfluous classid from domattributenames | cac45631c35217e930c38750a0fa1dd20858543c | <ide><path>src/browser/ui/dom/HTMLDOMPropertyConfig.js
<ide> var HTMLDOMPropertyConfig = {
<ide> property: null // Supports OG in meta tags
<ide> },
<ide> DOMAttributeNames: {
<del> classID: 'classid',
<ide> className: 'class',
<ide> htmlFor: 'for',
<ide> httpEquiv: 'http-equiv' | 1 |
Ruby | Ruby | fix broken asset test | a89d39ec889c2658120e508bd182de7be3ccdcc9 | <ide><path>railties/test/application/assets_test.rb
<ide> def app
<ide>
<ide> test "assets do not require compressors until it is used" do
<ide> app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();"
<del> add_to_config "config.assets.compile = true"
<add> app_file "config/initializers/compile.rb", "Rails.application.config.assets.compile = true"
<ide>
<ide> ENV["RAILS_ENV"] = "production"
<ide> require "#{app_path}/config/environment"
<ide> class ::PostsController < ActionController::Base ; end
<ide>
<ide> test "assets routes are not drawn when compilation is disabled" do
<ide> app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();"
<del> app_file "config/initializers/compile.rb", "Rails.application.config.assets.compile = false"
<add> add_to_config "config.assets.compile = false"
<ide>
<ide> ENV["RAILS_ENV"] = "production"
<ide> require "#{app_path}/config/environment" | 1 |
Python | Python | update get_constraints with better comments | 77028194415cb03b1ff2a85a86d806a0366bccff | <ide><path>django/db/backends/__init__.py
<ide> def get_indexes(self, cursor, table_name):
<ide>
<ide> def get_constraints(self, cursor, table_name):
<ide> """
<del> Returns {'cnname': {'columns': set(columns), 'primary_key': bool, 'unique': bool}}
<del>
<del> Both single- and multi-column constraints are introspected.
<add> Retrieves any constraints or keys (unique, pk, fk, check, index)
<add> across one or more columns.
<add>
<add> Returns a dict mapping constraint names to their attributes,
<add> where attributes is a dict with keys:
<add> * columns: List of columns this covers
<add> * primary_key: True if primary key, False otherwise
<add> * unique: True if this is a unique constraint, False otherwise
<add> * foreign_key: (table, column) of target, or None
<add> * check: True if check constraint, False otherwise
<add> * index: True if index, False otherwise.
<add>
<add> Some backends may return special constraint names that don't exist
<add> if they don't name constraints of a certain type (e.g. SQLite)
<ide> """
<ide> raise NotImplementedError
<ide>
<ide><path>django/db/backends/postgresql_psycopg2/introspection.py
<ide> def get_constraints(self, cursor, table_name):
<ide> "columns": [],
<ide> "primary_key": False,
<ide> "unique": False,
<del> "foreign_key": False,
<add> "foreign_key": None,
<ide> "check": True,
<ide> "index": False,
<ide> }
<ide> def get_constraints(self, cursor, table_name):
<ide> "columns": list(columns),
<ide> "primary_key": primary,
<ide> "unique": unique,
<del> "foreign_key": False,
<add> "foreign_key": None,
<ide> "check": False,
<ide> "index": True,
<ide> } | 2 |
Javascript | Javascript | remove outdated model documentation | ee17c71909d030018881877018f86138d54f5c7b | <ide><path>packages/ember-routing/lib/system/route.js
<ide> var Route = EmberObject.extend(ActionHandler, {
<ide> });
<ide> ```
<ide>
<del> The model for the `post` route is `App.Post.find(params.post_id)`.
<add> The model for the `post` route is `store.find('post', params.post_id)`.
<ide>
<ide> By default, if your route has a dynamic segment ending in `_id`:
<ide>
<ide> var Route = EmberObject.extend(ActionHandler, {
<ide> ```js
<ide> App.PostRoute = Ember.Route.extend({
<ide> model: function(params) {
<del> return App.Post.find(params.post_id);
<add> return this.store.find('post', params.post_id);
<ide> }
<ide> });
<ide> ```
<ide> var Route = EmberObject.extend(ActionHandler, {
<ide> ```js
<ide> App.PhotosRoute = Ember.Route.extend({
<ide> model: function() {
<del> return App.Photo.find();
<add> return this.store.find('photo');
<ide> },
<ide>
<ide> setupController: function (controller, model) { | 1 |
Python | Python | fix import order to make alphabetical | 839e752d1966181ed8390fb1611f59f954e5a106 | <ide><path>object_detection/utils/visualization_utils.py
<ide> import PIL.ImageColor as ImageColor
<ide> import PIL.ImageDraw as ImageDraw
<ide> import PIL.ImageFont as ImageFont
<del>import tensorflow as tf
<ide> import six
<add>import tensorflow as tf
<ide>
<ide>
<ide> _TITLE_LEFT_MARGIN = 10 | 1 |
Ruby | Ruby | check pour from requirements | 363f2c116cf6256148624c841e62b59c508565f4 | <ide><path>Library/Homebrew/formula_installer.rb
<ide> def pour_bottle? install_bottle_options={:warn=>false}
<ide> return true if f.local_bottle_path
<ide> return false unless f.bottle && f.pour_bottle?
<ide>
<add> f.requirements.each do |req|
<add> next if req.optional? || req.pour_bottle?
<add> if install_bottle_options[:warn]
<add> ohai "Building source; bottle blocked by #{req} requirement"
<add> end
<add> return false
<add> end
<add>
<ide> unless f.bottle.compatible_cellar?
<ide> if install_bottle_options[:warn]
<ide> opoo "Building source; cellar of #{f}'s bottle is #{f.bottle.cellar}" | 1 |
Javascript | Javascript | add additional message to internal invariants | 915a3e88a25690bd13e1e740f6de60b698858f82 | <ide><path>src/renderers/shared/fiber/ReactChildFiber.js
<ide> const {
<ide> Deletion,
<ide> } = ReactTypeOfSideEffect;
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> function coerceRef(current: ?Fiber, element: ReactElement) {
<ide> let mixedRef = element.ref;
<ide> if (mixedRef != null && typeof mixedRef !== 'function') {
<ide> function coerceRef(current: ?Fiber, element: ReactElement) {
<ide> inst = (owner : any).getPublicInstance();
<ide> }
<ide> }
<del> invariant(inst, 'Missing owner for string ref %s', mixedRef);
<add> invariant(
<add> inst, 'Missing owner for string ref %s. (%s)',
<add> mixedRef,
<add> internalErrorMessage
<add> );
<ide> const stringRef = String(mixedRef);
<ide> // Check if previous string ref matches new string ref
<ide> if (current && current.ref && current.ref._stringRef === stringRef) {
<ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) {
<ide> const iteratorFn = getIteratorFn(newChildrenIterable);
<ide> invariant(
<ide> typeof iteratorFn === 'function',
<del> 'An object is not an iterable.'
<add> 'An object is not an iterable. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> if (__DEV__) {
<ide> function ChildReconciler(shouldClone, shouldTrackSideEffects) {
<ide> const newChildren = iteratorFn.call(newChildrenIterable);
<ide> invariant(
<ide> newChildren != null,
<del> 'An iterable object provided no iterator.'
<add> 'An iterable object provided no iterator.',
<ide> );
<ide>
<ide> let resultingFirstChild : ?Fiber = null;
<ide><path>src/renderers/shared/fiber/ReactFiberBeginWork.js
<ide> if (__DEV__) {
<ide> var warnedAboutStatelessRefs = {};
<ide> }
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> config : HostConfig<T, P, I, TI, PI, C, CX, PL>,
<ide> hostContext : HostContext<C, CX>,
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> nextProps = memoizedProps;
<ide> invariant(
<ide> nextProps !== null,
<del> 'We should always have pending or current props.'
<add> 'We should always have pending or current props. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> } else if (nextProps === null || memoizedProps === nextProps) {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> function mountIndeterminateComponent(current, workInProgress, priorityLevel) {
<ide> invariant(
<ide> current === null,
<del> 'An indeterminate component should never have mounted'
<add> 'An indeterminate component should never have mounted. (%s)',
<add> internalErrorMessage
<ide> );
<ide> var fn = workInProgress.type;
<ide> var props = workInProgress.pendingProps;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> nextCoroutine = current && current.memoizedProps;
<ide> invariant(
<ide> nextCoroutine != null,
<del> 'We should always have pending or current props.'
<add> 'We should always have pending or current props. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> nextChildren = current && current.memoizedProps;
<ide> invariant(
<ide> nextChildren != null,
<del> 'We should always have pending or current props.'
<add> 'We should always have pending or current props. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> case Fragment:
<ide> return updateFragment(current, workInProgress);
<ide> default:
<del> invariant(false, 'Unknown unit of work tag');
<add> invariant(
<add> false,
<add> 'Unknown unit of work tag. (%s)',
<add> internalErrorMessage
<add> );
<ide> }
<ide> }
<ide>
<ide> function beginFailedWork(current : ?Fiber, workInProgress : Fiber, priorityLevel : PriorityLevel) {
<ide> invariant(
<ide> workInProgress.tag === ClassComponent ||
<ide> workInProgress.tag === HostRoot,
<del> 'Invalid type of work'
<add> 'Invalid type of work. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> // Add an error effect so we can handle the error during the commit phase
<ide><path>src/renderers/shared/fiber/ReactFiberClassComponent.js
<ide> var invariant = require('invariant');
<ide>
<ide> const isArray = Array.isArray;
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function(
<ide> scheduleUpdate : (fiber : Fiber, priorityLevel : PriorityLevel) => void,
<ide> getPriorityContext : () => PriorityLevel,
<ide> module.exports = function(
<ide> let props = workInProgress.pendingProps;
<ide> invariant(
<ide> props,
<del> 'There must be pending props for an initial mount.'
<add> 'There must be pending props for an initial mount. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> const unmaskedContext = getUnmaskedContext(workInProgress);
<ide> module.exports = function(
<ide> newProps = workInProgress.memoizedProps;
<ide> invariant(
<ide> newProps != null,
<del> 'There should always be pending or memoized props.'
<add> 'There should always be pending or memoized props. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> const newUnmaskedContext = getUnmaskedContext(workInProgress);
<ide> module.exports = function(
<ide> newProps = oldProps;
<ide> invariant(
<ide> newProps != null,
<del> 'There should always be pending or memoized props.'
<add> 'There should always be pending or memoized props. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> const oldContext = instance.context;
<ide><path>src/renderers/shared/fiber/ReactFiberCommitWork.js
<ide> var {
<ide>
<ide> var invariant = require('invariant');
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> config : HostConfig<T, P, I, TI, PI, C, CX, PL>,
<ide> captureError : (failedFiber : Fiber, error: Error) => ?Fiber
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> }
<ide> invariant(
<ide> false,
<del> 'Expected to find a host parent.'
<add> 'Expected to find a host parent. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> }
<ide> invariant(
<ide> false,
<del> 'Expected to find a host parent.'
<add> 'Expected to find a host parent. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> default:
<ide> invariant(
<ide> false,
<del> 'Invalid host parent fiber.'
<add> 'Invalid host parent fiber. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> if (parentFiber.effectTag & ContentReset) {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> case HostText: {
<ide> invariant(
<ide> finishedWork.stateNode !== null && current != null,
<del> 'This should only be done during updates.'
<add> 'This should only be done during updates. (%s)',
<add> internalErrorMessage
<ide> );
<ide> const textInstance : TI = finishedWork.stateNode;
<ide> const newText : string = finishedWork.memoizedProps;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> default: {
<ide> invariant(
<ide> false,
<del> 'This unit of work tag should not have side-effects.'
<add> 'This unit of work tag should not have side-effects. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> }
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> default: {
<ide> invariant(
<ide> false,
<del> 'This unit of work tag should not have side-effects.'
<add> 'This unit of work tag should not have side-effects. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> }
<ide><path>src/renderers/shared/fiber/ReactFiberCompleteWork.js
<ide> if (__DEV__) {
<ide>
<ide> var invariant = require('invariant');
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> config : HostConfig<T, P, I, TI, PI, C, CX, PL>,
<ide> hostContext : HostContext<C, CX>,
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> var coroutine = (workInProgress.memoizedProps : ?ReactCoroutine);
<ide> invariant(
<ide> coroutine,
<del> 'Should be resolved by now'
<add> 'Should be resolved by now. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> // First step of the coroutine has completed. Now we need to do the second.
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> if (!newProps) {
<ide> invariant(
<ide> workInProgress.stateNode !== null,
<del> 'We must have new props for new mounts'
<add> 'We must have new props for new mounts. (%s)',
<add> internalErrorMessage
<ide> );
<ide> // This can happen when we abort work.
<ide> return null;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> if (typeof newText !== 'string') {
<ide> invariant(
<ide> workInProgress.stateNode !== null,
<del> 'We must have new props for new mounts'
<add> 'We must have new props for new mounts. (%s)',
<add> internalErrorMessage
<ide> );
<ide> // This can happen when we abort work.
<ide> return null;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> case IndeterminateComponent:
<ide> invariant(
<ide> false,
<del> 'An indeterminate component should have become determinate before completing.'
<add> 'An indeterminate component should have become determinate before completing. (%s)',
<add> internalErrorMessage
<ide> );
<ide> // eslint-disable-next-line no-fallthrough
<ide> default:
<ide> invariant(
<ide> false,
<del> 'Unknown unit of work tag'
<add> 'Unknown unit of work tag. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> }
<ide><path>src/renderers/shared/fiber/ReactFiberHostContext.js
<ide> export type HostContext<C, CX> = {
<ide> resetHostContainer() : void,
<ide> };
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> config : HostConfig<T, P, I, TI, PI, C, CX, PL>
<ide> ) : HostContext<C, CX> {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> const rootInstance = rootInstanceStackCursor.current;
<ide> invariant(
<ide> rootInstance != null,
<del> 'Expected root container to exist.'
<add> 'Expected root container to exist. (%s)',
<add> internalErrorMessage
<ide> );
<ide> return rootInstance;
<ide> }
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> const context = contextStackCursor.current;
<ide> invariant(
<ide> context != null,
<del> 'Expected host context to exist.'
<add> 'Expected host context to exist. (%s)',
<add> internalErrorMessage
<ide> );
<ide> return context;
<ide> }
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> const rootInstance = rootInstanceStackCursor.current;
<ide> invariant(
<ide> rootInstance != null,
<del> 'Expected root host context to exist.'
<add> 'Expected root host context to exist. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> const context = contextStackCursor.current || emptyObject;
<ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js
<ide> if (__DEV__) {
<ide>
<ide> var timeHeuristicForUnitOfWork = 1;
<ide>
<add>const internalErrorMessage =
<add> 'This error is likely caused by a bug in React. Please file an issue.';
<add>
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P, I, TI, PI, C, CX, PL>) {
<ide> const hostContext = ReactFiberHostContext(config);
<ide> const { popHostContainer, popHostContext, resetHostContainer } = hostContext;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> invariant(
<ide> root.current !== finishedWork,
<ide> 'Cannot commit the same tree as before. This is probably a bug ' +
<del> 'related to the return field.'
<add> 'related to the return field. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> // Updates that occur during the commit phase should have Task priority
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> } catch (error) {
<ide> invariant(
<ide> nextEffect != null,
<del> 'Should have next effect.'
<add> 'Should have next effect. (%s)',
<add> internalErrorMessage
<ide> );
<ide> captureError(nextEffect, error);
<ide> // Clean-up
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> } catch (error) {
<ide> invariant(
<ide> nextEffect != null,
<del> 'Should have next effect.'
<add> 'Should have next effect. (%s)',
<add> internalErrorMessage
<ide> );
<ide> captureError(nextEffect, error);
<ide> if (nextEffect) {
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> function performWork(priorityLevel : PriorityLevel, deadline : Deadline | null) {
<ide> invariant(
<ide> !isPerformingWork,
<del> 'performWork was called recursively.'
<add> 'performWork was called recursively. (%s)',
<add> internalErrorMessage
<ide> );
<ide> isPerformingWork = true;
<ide> const isPerformingDeferredWork = Boolean(deadline);
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> while (priorityLevel !== NoWork && !fatalError) {
<ide> invariant(
<ide> deadline || (priorityLevel < HighPriority),
<del> 'Cannot perform deferred work without a deadline.'
<add> 'Cannot perform deferred work without a deadline. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> // Before starting any work, check to see if there are any pending
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide>
<ide> invariant(
<ide> capturedError != null,
<del> 'No error for given unit of work.'
<add> 'No error for given unit of work. (%s)',
<add> internalErrorMessage
<ide> );
<ide>
<ide> let error;
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
<ide> default:
<ide> invariant(
<ide> false,
<del> 'Invalid type of work.'
<add> 'Invalid type of work. (%s)',
<add> internalErrorMessage
<ide> );
<ide> }
<ide> } | 7 |
Python | Python | correct an issue on cpu alert (always system...) | 44263e3760706820081fdf55f9116d5f1ad3e759 | <ide><path>glances/plugins/glances_cpu.py
<ide> def update_views(self):
<ide> for key in ['user', 'system', 'iowait']:
<ide> if key in self.stats:
<ide> self.views[key]['decoration'] = self.get_alert_log(self.stats[key], header=key)
<del> self.views['total']['decoration'] = self.get_alert_log(self.stats['total'], header="system")
<add> self.views['total']['decoration'] = self.get_alert_log(self.stats['total'], header=key)
<ide> # Alert only
<ide> for key in ['steal']:
<ide> if key in self.stats: | 1 |
Python | Python | set version to v2.1.0a7.dev0 | 27e3f98caea429afee75fce3e9a175137e45c006 | <ide><path>spacy/about.py
<ide> # fmt: off
<ide>
<ide> __title__ = "spacy-nightly"
<del>__version__ = "2.1.0a6"
<add>__version__ = "2.1.0a7.dev0"
<ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython"
<ide> __uri__ = "https://spacy.io"
<ide> __author__ = "Explosion AI"
<ide> __email__ = "[email protected]"
<ide> __license__ = "MIT"
<del>__release__ = True
<add>__release__ = False
<ide>
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" | 1 |
Python | Python | add donate link | 22992a0d533f7f68e9fa1845c86dae230d8ff9ba | <ide><path>docs/conf.py
<ide> html_theme = 'flask'
<ide> html_context = {
<ide> 'project_links': [
<del> ProjectLink('Donate to Pallets', 'https://psfmember.org/civicrm/contribute/transact?id=20'),
<add> ProjectLink('Donate to Pallets', 'https://psfmember.org/civicrm/contribute/transact?reset=1&id=20'),
<ide> ProjectLink('Flask Website', 'https://palletsprojects.com/p/flask/'),
<ide> ProjectLink('PyPI releases', 'https://pypi.org/project/Flask/'),
<ide> ProjectLink('Source Code', 'https://github.com/pallets/flask/'), | 1 |
Text | Text | add 3.28.0-beta.7 to changelog | 7683833ff3e12f796d8476b23cf7b3257c85d856 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.28.0-beta.7 (August 2, 2021)
<add>
<add>- [#19681](https://github.com/emberjs/ember.js/pull/19681) [BUGFIX] Restore previous hash behavior
<add>- [#19685](https://github.com/emberjs/ember.js/pull/19685) [BUGFIX] Fix memory leak in RouterService
<add>- [#19690](https://github.com/emberjs/ember.js/pull/19690) [BUGFIX] Deprecates String.prototype.htmlSafe targeting Ember 4.0, as intended by the original deprecation.
<add>
<ide> ### v3.28.0-beta.6 (June 21, 2021)
<ide>
<ide> - [#19584](https://github.com/emberjs/ember.js/pull/19584) [BUGFIX] Ensure hash objects correctly entangle as dependencies | 1 |
Ruby | Ruby | fix syntax error in assert_match | 9cd831a0b0cbb6c2d386ee59a3b13fa58cf10d12 | <ide><path>railties/test/application/rake/dbs_test.rb
<ide> def db_fixtures_load
<ide> `rails generate model book title:string`
<ide> `bundle exec rake db:migrate`
<ide> `bundle exec rake db:fixtures:load`
<del> assert_match(/#{expected[:database]}/),
<del> ActiveRecord::Base.connection_config[:database]
<add> assert_match(/#{expected[:database]}/,
<add> ActiveRecord::Base.connection_config[:database])
<ide> require "#{app_path}/app/models/book"
<ide> assert_equal 2, Book.count
<ide> end
<ide> def db_structure_dump_and_load
<ide> assert_match(/CREATE TABLE \"books\"/, structure_dump)
<ide> `bundle exec rake db:drop`
<ide> `bundle exec rake db:structure:load`
<del> assert_match(/#{expected[:database]}/),
<del> ActiveRecord::Base.connection_config[:database]
<add> assert_match(/#{expected[:database]}/,
<add> ActiveRecord::Base.connection_config[:database])
<ide> require "#{app_path}/app/models/book"
<ide> #if structure is not loaded correctly, exception would be raised
<ide> assert Book.count, 0
<ide> def db_test_load_structure
<ide> require "#{app_path}/app/models/book"
<ide> #if structure is not loaded correctly, exception would be raised
<ide> assert Book.count, 0
<del> assert_match(/#{ActiveRecord::Base.configurations['test']['database']}/),
<del> ActiveRecord::Base.connection_config[:database]
<add> assert_match(/#{ActiveRecord::Base.configurations['test']['database']}/,
<add> ActiveRecord::Base.connection_config[:database])
<ide> end
<ide> end
<ide> | 1 |
Python | Python | fix autocast for older pytorch | 14cc50d081c320331d850a64a54f1d732fa557ea | <ide><path>src/transformers/trainer.py
<ide> def training_step(self, model: nn.Module, inputs: Dict[str, Union[torch.Tensor,
<ide> return loss_mb.reduce_mean().detach().to(self.args.device)
<ide>
<ide> if self.use_amp:
<del> with autocast(dtype=self.amp_dtype):
<del> loss = self.compute_loss(model, inputs)
<add> if version.parse(torch.__version__) >= version.parse("1.10"):
<add> with autocast(dtype=self.amp_dtype):
<add> loss = self.compute_loss(model, inputs)
<add> else:
<add> with autocast():
<add> loss = self.compute_loss(model, inputs)
<ide> else:
<ide> loss = self.compute_loss(model, inputs)
<ide>
<ide> def prediction_step(
<ide> else:
<ide> if has_labels:
<ide> if self.use_amp:
<del> with autocast(dtype=self.amp_dtype):
<del> loss, outputs = self.compute_loss(model, inputs, return_outputs=True)
<add> if version.parse(torch.__version__) >= version.parse("1.10"):
<add> with autocast(dtype=self.amp_dtype):
<add> loss, outputs = self.compute_loss(model, inputs, return_outputs=True)
<add> else:
<add> with autocast():
<add> loss, outputs = self.compute_loss(model, inputs, return_outputs=True)
<ide> else:
<ide> loss, outputs = self.compute_loss(model, inputs, return_outputs=True)
<ide> loss = loss.mean().detach()
<ide> def prediction_step(
<ide> else:
<ide> loss = None
<ide> if self.use_amp:
<del> with autocast(dtype=self.amp_dtype):
<del> outputs = model(**inputs)
<add> if version.parse(torch.__version__) >= version.parse("1.10"):
<add> with autocast(dtype=self.amp_dtype):
<add> outputs = model(**inputs)
<add> else:
<add> with autocast():
<add> outputs = model(**inputs)
<ide> else:
<ide> outputs = model(**inputs)
<ide> if isinstance(outputs, dict): | 1 |
Javascript | Javascript | add runtime behavior to codegennativecommands | a6fffb7cd02220e23e2276553b0346d2a664f73d | <ide><path>Libraries/Utilities/codegenNativeCommands.js
<ide>
<ide> 'use strict';
<ide>
<add>import {dispatchCommand} from '../../Libraries/Renderer/shims/ReactNative';
<add>
<ide> type Options<T = string> = $ReadOnly<{|
<ide> supportedCommands: $ReadOnlyArray<T>,
<ide> |}>;
<ide>
<del>function codegenNativeCommands<T>(options: Options<$Keys<T>>): T {
<del> return (({}: any): T);
<add>function codegenNativeCommands<T: {}>(options: Options<$Keys<T>>): T {
<add> const commandObj = {};
<add>
<add> options.supportedCommands.forEach(command => {
<add> commandObj[command] = (ref, ...args) => {
<add> dispatchCommand(ref, command, args);
<add> };
<add> });
<add>
<add> return ((commandObj: any): T);
<ide> }
<ide>
<ide> export default codegenNativeCommands; | 1 |
Javascript | Javascript | improve unescapebuffer performance | 3bdcbdb1a085b35a3a50112a51781b31d8814294 | <ide><path>benchmark/querystring/querystring-unescapebuffer.js
<add>'use strict';
<add>var common = require('../common.js');
<add>var querystring = require('querystring');
<add>
<add>var bench = common.createBenchmark(main, {
<add> input: [
<add> 'there is nothing to unescape here',
<add> 'there%20are%20several%20spaces%20that%20need%20to%20be%20unescaped',
<add> 'there%2Qare%0-fake%escaped values in%%%%this%9Hstring',
<add> '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37'
<add> ],
<add> n: [10e6],
<add>});
<add>
<add>function main(conf) {
<add> var input = conf.input;
<add> var n = conf.n | 0;
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1)
<add> querystring.unescapeBuffer(input);
<add> bench.end(n);
<add>}
<ide><path>lib/querystring.js
<ide> const Buffer = require('buffer').Buffer;
<ide> function ParsedQueryString() {}
<ide> ParsedQueryString.prototype = Object.create(null);
<ide>
<del>
<add>const unhexTable = [
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 15
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16 - 31
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 32 - 47
<add> +0, +1, +2, +3, +4, +5, +6, +7, +8, +9, -1, -1, -1, -1, -1, -1, // 48 - 63
<add> -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 64 - 79
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80 - 95
<add> -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 96 - 111
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 112 - 127
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128 ...
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
<add> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255
<add>];
<ide> // a safe fast alternative to decodeURIComponent
<ide> function unescapeBuffer(s, decodeSpaces) {
<ide> var out = Buffer.allocUnsafe(s.length);
<ide> var state = 0;
<del> var n, m, hexchar;
<add> var n, m, hexchar, c;
<ide>
<del> for (var inIndex = 0, outIndex = 0; inIndex <= s.length; inIndex++) {
<del> var c = inIndex < s.length ? s.charCodeAt(inIndex) : NaN;
<add> for (var inIndex = 0, outIndex = 0; ; inIndex++) {
<add> if (inIndex < s.length) {
<add> c = s.charCodeAt(inIndex);
<add> } else {
<add> if (state > 0) {
<add> out[outIndex++] = 37/*%*/;
<add> if (state === 2)
<add> out[outIndex++] = hexchar;
<add> }
<add> break;
<add> }
<ide> switch (state) {
<ide> case 0: // Any character
<ide> switch (c) {
<ide> function unescapeBuffer(s, decodeSpaces) {
<ide>
<ide> case 1: // First hex digit
<ide> hexchar = c;
<del> if (c >= 48/*0*/ && c <= 57/*9*/) {
<del> n = c - 48/*0*/;
<del> } else if (c >= 65/*A*/ && c <= 70/*F*/) {
<del> n = c - 65/*A*/ + 10;
<del> } else if (c >= 97/*a*/ && c <= 102/*f*/) {
<del> n = c - 97/*a*/ + 10;
<del> } else {
<add> n = unhexTable[c];
<add> if (!(n >= 0)) {
<ide> out[outIndex++] = 37/*%*/;
<ide> out[outIndex++] = c;
<ide> state = 0;
<ide> function unescapeBuffer(s, decodeSpaces) {
<ide>
<ide> case 2: // Second hex digit
<ide> state = 0;
<del> if (c >= 48/*0*/ && c <= 57/*9*/) {
<del> m = c - 48/*0*/;
<del> } else if (c >= 65/*A*/ && c <= 70/*F*/) {
<del> m = c - 65/*A*/ + 10;
<del> } else if (c >= 97/*a*/ && c <= 102/*f*/) {
<del> m = c - 97/*a*/ + 10;
<del> } else {
<add> m = unhexTable[c];
<add> if (!(m >= 0)) {
<ide> out[outIndex++] = 37/*%*/;
<ide> out[outIndex++] = hexchar;
<ide> out[outIndex++] = c;
<ide> function unescapeBuffer(s, decodeSpaces) {
<ide>
<ide> // TODO support returning arbitrary buffers.
<ide>
<del> return out.slice(0, outIndex - 1);
<add> return out.slice(0, outIndex);
<ide> }
<ide>
<ide>
<ide><path>test/parallel/test-querystring.js
<ide> assert.strictEqual(0xd8, b[17]);
<ide> assert.strictEqual(0xa2, b[18]);
<ide> assert.strictEqual(0xe6, b[19]);
<ide>
<add>assert.strictEqual(qs.unescapeBuffer('a+b', true).toString(), 'a b');
<add>assert.strictEqual(qs.unescapeBuffer('a%').toString(), 'a%');
<add>assert.strictEqual(qs.unescapeBuffer('a%2').toString(), 'a%2');
<add>assert.strictEqual(qs.unescapeBuffer('a%20').toString(), 'a ');
<add>assert.strictEqual(qs.unescapeBuffer('a%2g').toString(), 'a%2g');
<add>assert.strictEqual(qs.unescapeBuffer('a%%').toString(), 'a%%');
<add>
<ide>
<ide> // Test custom decode
<ide> function demoDecode(str) { | 3 |
Javascript | Javascript | add tests for sortableset | b2a4244b87a7c5615e466f82f1afa7cb7fa3d9bf | <ide><path>test/SortableSet.test.js
<add>/* globals describe, it */
<add>"use strict";
<add>
<add>const SortableSet = require("../lib/util/SortableSet");
<add>
<add>describe("util/SortableSet", () => {
<add> it("Can be constructed like a normal Set", () => {
<add> const sortableSet = new SortableSet([1,1,1,1,1,4,5,2], () =>{});
<add> Array.from(sortableSet).should.eql([1,4,5,2]);
<add> });
<add>
<add> it("Can sort its content", () => {
<add> const sortableSet = new SortableSet([1,1,1,6,6,1,1,4,5,2,3,8,5,7,9,0,3,1], (a,b) => a - b);
<add> sortableSet.sort();
<add> Array.from(sortableSet).should.eql([0,1,2,3,4,5,6,7,8,9]);
<add> });
<add>
<add> it("Can sort by a specified function", () => {
<add> const sortableSet = new SortableSet([1,1,1,6,6,1,1,4,5,2,3,8,5,7,9,0,3,1], (a,b) => a - b);
<add> sortableSet.sortWith((a,b)=> b - a);
<add> Array.from(sortableSet).should.eql([9,8,7,6,5,4,3,2,1,0]);
<add> });
<add>}); | 1 |
PHP | PHP | change empty quotation to 0 | cc81e013a7544d54c302eecdccef6a6575dfbbfb | <ide><path>src/View/Helper/PaginatorHelper.php
<ide> public function limitControl(array $limits = [], $default = null, array $options
<ide> }
<ide>
<ide> if (empty($limits)) {
<del> $limits += array(''=>__('All'), '20' => '20', '50' => '50', '100' => '100');
<add> $limits += array('0'=>__('All'), '20' => '20', '50' => '50', '100' => '100');
<ide> }
<ide>
<ide> if (!in_array($default, $limits)) { | 1 |
Javascript | Javascript | allow aliasing of classnamebindings from templates | c3802f16380843b39c8363cda68d8813a3e00cdf | <ide><path>packages/sproutcore-handlebars/lib/helpers/binding.js
<ide> SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
<ide> // determine which class string to return, based on whether it is
<ide> // a Boolean or not.
<ide> var classStringForProperty = function(property) {
<add> var split = property.split(':'), className = split[1];
<add> property = split[0];
<add>
<ide> var val = getPath(context, property);
<ide>
<ide> // If value is a Boolean and true, return the dasherized property
<ide> // name.
<ide> if (val === YES) {
<add> if (className) { return className; }
<add>
<ide> // Normalize property path to be suitable for use
<ide> // as a class name. For exaple, content.foo.barBaz
<ide> // becomes bar-baz.
<ide> SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
<ide>
<ide> // For each property passed, loop through and setup
<ide> // an observer.
<del> classBindings.split(' ').forEach(function(property) {
<add> classBindings.split(' ').forEach(function(binding) {
<ide>
<ide> // Variable in which the old class value is saved. The observer function
<ide> // closes over this variable, so it knows which string to remove when
<ide> SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
<ide> // class name.
<ide> observer = function() {
<ide> // Get the current value of the property
<del> newClass = classStringForProperty(property);
<add> newClass = classStringForProperty(binding);
<ide> elem = id ? view.$("[data-handlebars-id='" + id + "']") : view.$();
<ide>
<ide> // If we can't find the element anymore, a parent template has been
<ide> // re-rendered and we've been nuked. Remove the observer.
<ide> if (elem.length === 0) {
<del> SC.removeObserver(context, property, invoker);
<add> SC.removeObserver(context, binding, invoker);
<ide> } else {
<ide> // If we had previously added a class to the element, remove it.
<ide> if (oldClass) {
<ide> SC.Handlebars.bindClasses = function(context, classBindings, view, id) {
<ide> SC.run.once(observer);
<ide> };
<ide>
<add> property = binding.split(':')[0];
<ide> SC.addObserver(context, property, invoker);
<ide>
<ide> // We've already setup the observer; now we just need to figure out the
<ide> // correct behavior right now on the first pass through.
<del> value = classStringForProperty(property);
<add> value = classStringForProperty(binding);
<ide>
<ide> if (value) {
<ide> ret.push(value);
<ide><path>packages/sproutcore-handlebars/tests/handlebars_test.js
<ide> test("should be able to bind boolean element attributes using {{bindAttr}}", fun
<ide> });
<ide>
<ide> test("should be able to add multiple classes using {{bindAttr class}}", function() {
<del> var template = SC.Handlebars.compile('<div {{bindAttr class="content.isAwesomeSauce content.isAlsoCool"}}></div>');
<add> var template = SC.Handlebars.compile('<div {{bindAttr class="content.isAwesomeSauce content.isAlsoCool content.isAmazing:amazing"}}></div>');
<ide> var content = SC.Object.create({
<ide> isAwesomeSauce: true,
<del> isAlsoCool: true
<add> isAlsoCool: true,
<add> isAmazing: true
<ide> });
<ide>
<ide> view = SC.View.create({
<ide> test("should be able to add multiple classes using {{bindAttr class}}", function
<ide>
<ide> ok(view.$('div').hasClass('is-awesome-sauce'), "dasherizes first property and sets classname");
<ide> ok(view.$('div').hasClass('is-also-cool'), "dasherizes second property and sets classname");
<add> ok(view.$('div').hasClass('amazing'), "uses alias for third property and sets classname");
<ide>
<ide> SC.run(function() {
<ide> set(content, 'isAwesomeSauce', false);
<add> set(content, 'isAmazing', false);
<ide> });
<ide>
<ide> ok(!view.$('div').hasClass('is-awesome-sauce'), "removes dasherized class when property is set to false");
<add> ok(!view.$('div').hasClass('amazing'), "removes aliased class when property is set to false");
<ide> });
<ide>
<ide> test("should be able to output a property without binding", function(){ | 2 |
Text | Text | add master builds url to readme | 1b104ce7c3b18ad4bd38a819525a0d5ad78d3c85 | <ide><path>README.md
<ide> documentation, please take a look at this [README.md](https://github.com/docker/
<ide> These instructions are probably not perfect, please let us know if anything
<ide> feels wrong or incomplete.
<ide>
<add>Want to run Docker from a master build? You can can download
<add>master builds at [master.dockerproject.com](https://master.dockerproject.com).
<add>They are updated with each commit merged into the master branch.
<add>
<ide> ### Legal
<ide>
<ide> *Brought to you courtesy of our legal counsel. For more context, | 1 |
Ruby | Ruby | remove explicit type check | 0d4f241d481ee5bc356366c7a1383541338d3365 | <ide><path>Library/Homebrew/version.rb
<ide> def inspect
<ide> def to_s
<ide> value.to_s
<ide> end
<add>
<add> def numeric?
<add> false
<add> end
<ide> end
<ide>
<ide> class NullToken < Token
<ide> def <=>(other)
<ide> -Integer(other <=> self)
<ide> end
<ide> end
<add>
<add> def numeric?
<add> true
<add> end
<ide> end
<ide>
<ide> class CompositeToken < StringToken
<ide> def to_s
<ide> protected
<ide>
<ide> def begins_with_numeric?
<del> NumericToken === tokens.first
<add> tokens.first.numeric?
<ide> end
<ide>
<ide> def pad_to(length)
<ide> if begins_with_numeric?
<del> nums, rest = tokens.partition { |t| NumericToken === t }
<add> nums, rest = tokens.partition(&:numeric?)
<ide> nums.fill(NULL_TOKEN, nums.length, length - tokens.length)
<ide> nums.concat(rest)
<ide> else | 1 |
Ruby | Ruby | display executables with missing rpath | caf310038f1dda4f8efd37fa1b095844b2664102 | <ide><path>Library/Homebrew/extend/pathname.rb
<ide> def mach_o_bundle?
<ide> def dylib?
<ide> false
<ide> end
<add>
<add> sig { returns(T::Array[String]) }
<add> def rpaths
<add> []
<add> end
<ide> end
<ide>
<ide> require "extend/os/pathname"
<ide><path>Library/Homebrew/linkage_checker.rb
<ide> def initialize(keg, formula = nil, cache_db:, rebuild_cache: false)
<ide> @unnecessary_deps = []
<ide> @unwanted_system_dylibs = []
<ide> @version_conflict_deps = []
<add> @executables_missing_rpaths = []
<ide>
<ide> check_dylibs(rebuild_cache: rebuild_cache)
<ide> end
<ide> def display_normal_output
<ide> display_items "Undeclared dependencies with linkage", @undeclared_deps
<ide> display_items "Dependencies with no linkage", @unnecessary_deps
<ide> display_items "Unwanted system libraries", @unwanted_system_dylibs
<add> display_items "Executables with missing rpath", @executables_missing_rpaths
<ide> end
<ide>
<ide> def display_reverse_output
<ide> def display_test_output(puts_output: true, strict: false)
<ide> display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output
<ide> display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output
<ide> display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output if strict
<add> display_items "Executables with missing rpath", @executables_missing_rpaths, puts_output: puts_output
<ide> end
<ide>
<ide> sig { params(strict: T::Boolean).returns(T::Boolean) }
<ide> def broken_library_linkage?(strict: false)
<del> issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps]
<add> issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps, @executables_missing_rpaths]
<ide> issues << @undeclared_deps if strict
<ide> [issues, unexpected_broken_dylibs, unexpected_present_dylibs].flatten.any?(&:present?)
<ide> end
<ide> def check_dylibs(rebuild_cache:)
<ide> checked_dylibs = Set.new
<ide>
<ide> keg_files_dylibs.each do |file, dylibs|
<add> file_has_any_rpath_dylibs = T.let(false, T::Boolean)
<ide> dylibs.each do |dylib|
<ide> @reverse_links[dylib] << file
<ide>
<add> # Binary executables that link @rpath-prefixed dylibs must include at
<add> # least one rpath in order to resolve it.
<add> if !file_has_any_rpath_dylibs && (dylib.start_with? "@rpath/")
<add> file_has_any_rpath_dylibs = true
<add> pathname = Pathname(file)
<add> @executables_missing_rpaths << file if pathname.binary_executable? && pathname.rpaths.empty?
<add> end
<add>
<ide> next if checked_dylibs.include? dylib
<ide>
<ide> checked_dylibs << dylib
<ide><path>Library/Homebrew/os/linux/elf.rb
<ide> def binary_executable?
<ide> elf_type == :executable
<ide> end
<ide>
<add> # The runtime search path, such as:
<add> # "/lib:/usr/lib:/usr/local/lib"
<ide> def rpath
<ide> return @rpath if defined? @rpath
<ide>
<ide> @rpath = rpath_using_patchelf_rb
<ide> end
<ide>
<add> # An array of runtime search path entries, such as:
<add> # ["/lib", "/usr/lib", "/usr/local/lib"]
<add> def rpaths
<add> rpath.split(":")
<add> end
<add>
<ide> def interpreter
<ide> return @interpreter if defined? @interpreter
<ide> | 3 |
Javascript | Javascript | add more tests | f74aa0eff9bab45be57d81fa3bb40d547aa2aa63 | <ide><path>spec/text-editor-spec.js
<ide> describe('TextEditor', () => {
<ide> expect(editor.lineTextForBufferRow(0)).toBe('test')
<ide> })
<ide>
<del> it('does not select the new delimiters when the option is set'), () => {
<add> it('does not select the new delimiters'), () => {
<add> editor.setText('<!-- test -->')
<add>
<ide> let delimLength = '<!--'.length
<ide> let selection = editor.addCursorAtBufferPosition([0, delimLength])
<ide>
<del> editor.setText('<!-- test -->')
<del>
<ide> selection.toggleLineComments()
<ide> expect(selection.isEmpty() && selection.getBufferRange().start.column === 0).toBe(true)
<ide>
<ide> selection.toggleLineComments()
<ide> expect(selection.isEmpty() && selection.getBufferRange().start.column === delimLength).toBe(true)
<ide>
<ide> selection.setBufferRange([[0, delimLength], [0, delimLength + 1 + 'test'.length]])
<del>
<add>
<ide> selection.toggleLineComments()
<ide> let range = selection.getBufferRange()
<ide> expect(range.start.column === 0 && range.end.column === 'test'.length).toBe(true)
<ide> describe('TextEditor', () => {
<ide> editor.setText(' test')
<ide> selection.setBufferRange([[0, 4], [0,4]])
<ide> selection.toggleLineComments()
<del> expect(selection.isEmpty() && selection.start.column === 4 + delimLength + 1)
<add> expect(selection.isEmpty() && selection.start.column === 4 + delimLength + 1).toBe(true)
<add>
<add> editor.setText(' test')
<add> selection.setBufferRange([[0, 8], [0, 8]])
<add> selection.selectToBeginningOfWord()
<add> selection.toggleLineComments()
<add> expect(selection.start.column === 4 + delimLength + 1).toBe(true)
<add> expect(selection.end.column === 4 + delimLength + 1 + 4).toBe(true)
<ide> }
<ide> })
<ide> | 1 |
Javascript | Javascript | use manual join instead of path.join | 1548676f56ae2b380ed3dc64003257e3de372fee | <ide><path>make.js
<ide> target.chrome = function() {
<ide>
<ide> // If we're on a Darwin (Mac) OS, then let's check for an .app path
<ide> if (process.platform === 'darwin' && executable.indexOf('.app') !== -1) {
<del> executable = path.join(executable, 'Contents', 'MacOS', 'Google Chrome');
<add> executable = executable + '/Contents/MacOS/Google Chrome');
<ide> }
<ide>
<ide> // If the chrome executable doesn't exist | 1 |
Python | Python | add test for final() method | 96e91f5841c171a1bcf7571a053ab19de16f402f | <ide><path>djangorestframework/tests/views.py
<ide> from django.conf.urls.defaults import patterns, url
<add>from django.http import HttpResponse
<ide> from django.test import TestCase
<ide> from django.test import Client
<ide> from django import forms
<ide> class MockView(View):
<ide> """This is a basic mock view"""
<ide> pass
<ide>
<add>
<add>class MockViewFinal(View):
<add> """View with final() override"""
<add>
<add> def final(self, request, response, *args, **kwargs):
<add> return HttpResponse('{"test": "passed"}', content_type="application/json")
<add>
<ide> class ResourceMockView(View):
<ide> """This is a resource-based mock view"""
<ide>
<ide> class MockResourceModel(models.Model):
<ide> url(r'^accounts/login$', 'api_login'),
<ide> url(r'^accounts/logout$', 'api_logout'),
<ide> url(r'^mock/$', MockView.as_view()),
<add> url(r'^mock/final/$', MockViewFinal.as_view()),
<ide> url(r'^resourcemock/$', ResourceMockView.as_view()),
<ide> url(r'^model/$', ListOrCreateModelView.as_view(resource=MockResource)),
<ide> url(r'^model/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=MockResource)),
<ide> class BaseViewTests(TestCase):
<ide> """Test the base view class of djangorestframework"""
<ide> urls = 'djangorestframework.tests.views'
<ide>
<add> def test_view_call_final(self):
<add> response = self.client.options('/mock/final/')
<add> self.assertEqual(response['Content-Type'].split(';')[0], "application/json")
<add> parser = JSONParser(None)
<add> (data, files) = parser.parse(StringIO(response.content))
<add> self.assertEqual(data['test'], 'passed')
<add>
<ide> def test_options_method_simple_view(self):
<ide> response = self.client.options('/mock/')
<ide> self._verify_options_response(response, | 1 |
Text | Text | fix doc mobilenetv2 invalid package | f93a2256ab11eeebbedf7b79d5c34399ba992b9c | <ide><path>docs/templates/applications.md
<ide> These weights are released under [the Apache License](https://github.com/tensorf
<ide>
<ide>
<ide> ```python
<del>keras.applications.mobilenetv2.MobileNetV2(input_shape=None, alpha=1.0, depth_multiplier=1, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000)
<add>keras.applications.mobilenet_v2.MobileNetV2(input_shape=None, alpha=1.0, depth_multiplier=1, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000)
<ide> ```
<ide>
<ide> MobileNetV2 model, with weights pre-trained on ImageNet. | 1 |
Javascript | Javascript | run more assert tests | b5f2942fb55055b5a8b5de290953f81d2e291005 | <ide><path>test/parallel/test-assert-deep.js
<ide> class MyDate extends Date {
<ide>
<ide> const date2 = new MyDate('2016');
<ide>
<del>// deepEqual returns true as long as the time are the same,
<del>// but deepStrictEqual checks own properties
<del>assert.notDeepEqual(date, date2);
<del>assert.notDeepEqual(date2, date);
<add>assertNotDeepOrStrict(date, date2);
<ide> assert.throws(
<ide> () => assert.deepStrictEqual(date, date2),
<ide> {
<ide> class MyRegExp extends RegExp {
<ide> const re1 = new RegExp('test');
<ide> const re2 = new MyRegExp('test');
<ide>
<del>// deepEqual returns true as long as the regexp-specific properties
<del>// are the same, but deepStrictEqual checks all properties
<del>assert.notDeepEqual(re1, re2);
<add>assertNotDeepOrStrict(re1, re2);
<ide> assert.throws(
<ide> () => assert.deepStrictEqual(re1, re2),
<ide> {
<ide> assert.throws(
<ide> }
<ide> );
<ide>
<del>assert.deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));
<add>assertDeepAndStrictEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));
<ide>
<ide> assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
<ide> AssertionError,
<ide> assert.throws(
<ide> 'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
<ide> );
<ide>
<del>assert.notDeepEqual(new Date(), new Date(2000, 3, 14));
<add>assertNotDeepOrStrict(new Date(), new Date(2000, 3, 14));
<ide>
<ide> assertDeepAndStrictEqual(/a/, /a/);
<ide> assertDeepAndStrictEqual(/a/g, /a/g);
<ide> a2.b = true;
<ide> a2.a = 'test';
<ide> assert.throws(() => assert.deepEqual(Object.keys(a1), Object.keys(a2)),
<ide> AssertionError);
<del>assert.deepEqual(a1, a2);
<add>assertDeepAndStrictEqual(a1, a2);
<ide>
<ide> // Having an identical prototype property.
<ide> const nbRoot = {
<ide> assert.throws(
<ide>
<ide> /* eslint-enable */
<ide>
<del>assert.deepStrictEqual({ a: 4, b: '1' }, { b: '1', a: 4 });
<add>assertDeepAndStrictEqual({ a: 4, b: '1' }, { b: '1', a: 4 });
<ide>
<ide> assert.throws(
<ide> () => assert.deepStrictEqual([0, 1, 2, 'a', 'b'], [0, 1, 2, 'b', 'a']),
<ide> AssertionError);
<ide>
<del>assert.deepStrictEqual(a1, a2);
<del>
<ide> // Prototype check.
<ide> function Constructor1(first, last) {
<ide> this.first = first;
<ide> assert.throws(() => assert.deepStrictEqual(obj1, obj2), AssertionError);
<ide> Constructor2.prototype = Constructor1.prototype;
<ide> obj2 = new Constructor2('Ryan', 'Dahl');
<ide>
<del>assert.deepStrictEqual(obj1, obj2);
<add>assertDeepAndStrictEqual(obj1, obj2);
<ide>
<ide> // Check extra properties on errors.
<ide> {
<ide> assert.throws(
<ide> Object.defineProperty(a, 'getTime', {
<ide> value: () => 5
<ide> });
<del> assert.deepStrictEqual(a, b);
<add> assertDeepAndStrictEqual(a, b);
<ide> }
<ide>
<ide> // Verify that extra keys will be tested for when using fake arrays.
<ide> assert.throws(
<ide> Object.defineProperty(a, 'length', {
<ide> value: 2
<ide> });
<del> assert.notDeepStrictEqual(a, [1, 1]);
<add> assertNotDeepOrStrict(a, [1, 1]);
<ide> }
<ide>
<ide> // Verify that changed tags will still check for the error message. | 1 |
Python | Python | add some field schema alteration methods and tests | 959a3f9791d780062c4efe8765404a8ef95e87f0 | <ide><path>django/db/backends/__init__.py
<ide> class BaseDatabaseFeatures(object):
<ide> # Can we roll back DDL in a transaction?
<ide> can_rollback_ddl = False
<ide>
<add> # Can we issue more than one ALTER COLUMN clause in an ALTER TABLE?
<add> supports_combined_alters = False
<add>
<ide> def __init__(self, connection):
<ide> self.connection = connection
<ide>
<ide><path>django/db/backends/postgresql_psycopg2/base.py
<ide> class DatabaseFeatures(BaseDatabaseFeatures):
<ide> supports_tablespaces = True
<ide> can_distinct_on_fields = True
<ide> can_rollback_ddl = True
<add> supports_combined_alters = True
<ide>
<ide> class DatabaseWrapper(BaseDatabaseWrapper):
<ide> vendor = 'postgresql'
<ide><path>django/db/backends/schema.py
<ide> from django.db import transaction
<ide> from django.db.utils import load_backend
<ide> from django.utils.log import getLogger
<add>from django.db.models.fields.related import ManyToManyField
<ide>
<ide> logger = getLogger('django.db.backends.schema')
<ide>
<ide> class BaseDatabaseSchemaEditor(object):
<ide> sql_rename_table = "ALTER TABLE %(old_table)s RENAME TO %(new_table)s"
<ide> sql_delete_table = "DROP TABLE %(table)s CASCADE"
<ide>
<del> sql_create_column = "ALTER TABLE %(table)s ADD COLUMN %(definition)s"
<add> sql_create_column = "ALTER TABLE %(table)s ADD COLUMN %(column)s %(definition)s"
<add> sql_alter_column = "ALTER TABLE %(table)s %(changes)s"
<ide> sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s"
<ide> sql_alter_column_null = "ALTER COLUMN %(column)s DROP NOT NULL"
<ide> sql_alter_column_not_null = "ALTER COLUMN %(column)s SET NOT NULL"
<del> sql_delete_column = "ALTER TABLE %(table)s DROP COLUMN %(column)s CASCADE;"
<add> sql_alter_column_default = "ALTER COLUMN %(column)s SET DEFAULT %(default)s"
<add> sql_alter_column_no_default = "ALTER COLUMN %(column)s DROP DEFAULT"
<add> sql_delete_column = "ALTER TABLE %(table)s DROP COLUMN %(column)s CASCADE"
<add> sql_rename_column = "ALTER TABLE %(table)s RENAME COLUMN %(old_column)s TO %(new_column)s"
<ide>
<ide> sql_create_check = "ADD CONSTRAINT %(name)s CHECK (%(check)s)"
<ide> sql_delete_check = "ALTER TABLE %(table)s DROP CONSTRAINT %(name)s"
<ide> def execute(self, sql, params=[], fetch_results=False):
<ide> def quote_name(self, name):
<ide> return self.connection.ops.quote_name(name)
<ide>
<add> # Field <-> database mapping functions
<add>
<add> def column_sql(self, model, field, include_default=False):
<add> """
<add> Takes a field and returns its column definition.
<add> The field must already have had set_attributes_from_name called.
<add> """
<add> # Get the column's type and use that as the basis of the SQL
<add> sql = field.db_type(connection=self.connection)
<add> params = []
<add> # Check for fields that aren't actually columns (e.g. M2M)
<add> if sql is None:
<add> return None
<add> # Optionally add the tablespace if it's an implicitly indexed column
<add> tablespace = field.db_tablespace or model._meta.db_tablespace
<add> if tablespace and self.connection.features.supports_tablespaces and field.unique:
<add> sql += " %s" % self.connection.ops.tablespace_sql(tablespace, inline=True)
<add> # Work out nullability
<add> null = field.null
<add> # Oracle treats the empty string ('') as null, so coerce the null
<add> # option whenever '' is a possible value.
<add> if (field.empty_strings_allowed and not field.primary_key and
<add> self.connection.features.interprets_empty_strings_as_nulls):
<add> null = True
<add> if null:
<add> sql += " NULL"
<add> else:
<add> sql += " NOT NULL"
<add> # Primary key/unique outputs
<add> if field.primary_key:
<add> sql += " PRIMARY KEY"
<add> elif field.unique:
<add> sql += " UNIQUE"
<add> # If we were told to include a default value, do so
<add> if include_default:
<add> sql += " DEFAULT %s"
<add> params += [self.effective_default(field)]
<add> # Return the sql
<add> return sql, params
<add>
<add> def effective_default(self, field):
<add> "Returns a field's effective database default value"
<add> if field.has_default():
<add> default = field.get_default()
<add> elif not field.null and field.blank and field.empty_strings_allowed:
<add> default = ""
<add> else:
<add> default = None
<add> # If it's a callable, call it
<add> if callable(default):
<add> default = default()
<add> return default
<add>
<ide> # Actions
<ide>
<ide> def create_model(self, model):
<ide> def create_model(self, model):
<ide> """
<ide> # Do nothing if this is an unmanaged or proxy model
<ide> if not model._meta.managed or model._meta.proxy:
<del> return [], {}
<add> return
<ide> # Create column SQL, add FK deferreds if needed
<ide> column_sqls = []
<add> params = []
<ide> for field in model._meta.local_fields:
<ide> # SQL
<del> definition = self.column_sql(model, field)
<add> definition, extra_params = self.column_sql(model, field)
<ide> if definition is None:
<ide> continue
<ide> column_sqls.append("%s %s" % (
<ide> self.quote_name(field.column),
<ide> definition,
<ide> ))
<add> params.extend(extra_params)
<ide> # FK
<ide> if field.rel:
<ide> to_table = field.rel.to._meta.db_table
<ide> def create_model(self, model):
<ide> "table": model._meta.db_table,
<ide> "definition": ", ".join(column_sqls)
<ide> }
<del> self.execute(sql)
<add> self.execute(sql, params)
<ide>
<del> def column_sql(self, model, field, include_default=False):
<add> def delete_model(self, model):
<ide> """
<del> Takes a field and returns its column definition.
<del> The field must already have had set_attributes_from_name called.
<add> Deletes a model from the database.
<ide> """
<del> # Get the column's type and use that as the basis of the SQL
<del> sql = field.db_type(connection=self.connection)
<del> # Check for fields that aren't actually columns (e.g. M2M)
<del> if sql is None:
<del> return None
<del> # Optionally add the tablespace if it's an implicitly indexed column
<del> tablespace = field.db_tablespace or model._meta.db_tablespace
<del> if tablespace and self.connection.features.supports_tablespaces and field.unique:
<del> sql += " %s" % self.connection.ops.tablespace_sql(tablespace, inline=True)
<del> # Work out nullability
<del> null = field.null
<del> # Oracle treats the empty string ('') as null, so coerce the null
<del> # option whenever '' is a possible value.
<del> if (field.empty_strings_allowed and not field.primary_key and
<del> self.connection.features.interprets_empty_strings_as_nulls):
<del> null = True
<del> if null:
<del> sql += " NULL"
<del> else:
<del> sql += " NOT NULL"
<del> # Primary key/unique outputs
<del> if field.primary_key:
<del> sql += " PRIMARY KEY"
<del> elif field.unique:
<del> sql += " UNIQUE"
<del> # If we were told to include a default value, do so
<del> if include_default:
<del> raise NotImplementedError()
<del> # Return the sql
<del> return sql
<del>
<del> def delete_model(self, model):
<add> # Do nothing if this is an unmanaged or proxy model
<add> if not model._meta.managed or model._meta.proxy:
<add> return
<add> # Delete the table
<ide> self.execute(self.sql_delete_table % {
<ide> "table": self.quote_name(model._meta.db_table),
<ide> })
<add>
<add> def create_field(self, model, field, keep_default=False):
<add> """
<add> Creates a field on a model.
<add> Usually involves adding a column, but may involve adding a
<add> table instead (for M2M fields)
<add> """
<add> # Special-case implicit M2M tables
<add> if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
<add> return self.create_model(field.rel.through)
<add> # Get the column's definition
<add> definition, params = self.column_sql(model, field, include_default=True)
<add> # It might not actually have a column behind it
<add> if definition is None:
<add> return
<add> # Build the SQL and run it
<add> sql = self.sql_create_column % {
<add> "table": self.quote_name(model._meta.db_table),
<add> "column": self.quote_name(field.column),
<add> "definition": definition,
<add> }
<add> self.execute(sql, params)
<add> # Drop the default if we need to
<add> # (Django usually does not use in-database defaults)
<add> if not keep_default and field.default is not None:
<add> sql = self.sql_alter_column % {
<add> "table": self.quote_name(model._meta.db_table),
<add> "changes": self.sql_alter_column_no_default % {
<add> "column": self.quote_name(field.column),
<add> }
<add> }
<add> # Add any FK constraints later
<add> if field.rel:
<add> to_table = field.rel.to._meta.db_table
<add> to_column = field.rel.to._meta.get_field(field.rel.field_name).column
<add> self.deferred_sql.append(
<add> self.sql_create_fk % {
<add> "name": '%s_refs_%s_%x' % (
<add> field.column,
<add> to_column,
<add> abs(hash((model._meta.db_table, to_table)))
<add> ),
<add> "table": self.quote_name(model._meta.db_table),
<add> "column": self.quote_name(field.column),
<add> "to_table": self.quote_name(to_table),
<add> "to_column": self.quote_name(to_column),
<add> }
<add> )
<add>
<add> def delete_field(self, model, field):
<add> """
<add> Removes a field from a model. Usually involves deleting a column,
<add> but for M2Ms may involve deleting a table.
<add> """
<add> # Special-case implicit M2M tables
<add> if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
<add> return self.delete_model(field.rel.through)
<add> # Get the column's definition
<add> definition, params = self.column_sql(model, field)
<add> # It might not actually have a column behind it
<add> if definition is None:
<add> return
<add> # Delete the column
<add> sql = self.sql_delete_column % {
<add> "table": self.quote_name(model._meta.db_table),
<add> "column": self.quote_name(field.column),
<add> }
<add> self.execute(sql)
<add>
<add> def alter_field(self, model, old_field, new_field):
<add> """
<add> Allows a field's type, uniqueness, nullability, default, column,
<add> constraints etc. to be modified.
<add> Requires a copy of the old field as well so we can only perform
<add> changes that are required.
<add> """
<add> # Ensure this field is even column-based
<add> old_type = old_field.db_type(connection=self.connection)
<add> new_type = new_field.db_type(connection=self.connection)
<add> if old_type is None and new_type is None:
<add> # TODO: Handle M2M fields being repointed
<add> return
<add> elif old_type is None or new_type is None:
<add> raise ValueError("Cannot alter field %s into %s - they are not compatible types" % (
<add> old_field,
<add> new_field,
<add> ))
<add> # First, have they renamed the column?
<add> if old_field.column != new_field.column:
<add> self.execute(self.sql_rename_column % {
<add> "table": self.quote_name(model._meta.db_table),
<add> "old_column": self.quote_name(old_field.column),
<add> "new_column": self.quote_name(new_field.column),
<add> })
<add> # Next, start accumulating actions to do
<add> actions = []
<add> # Type change?
<add> if old_type != new_type:
<add> actions.append((
<add> self.sql_alter_column_type % {
<add> "column": self.quote_name(new_field.column),
<add> "type": new_type,
<add> },
<add> [],
<add> ))
<add> # Default change?
<add> old_default = self.effective_default(old_field)
<add> new_default = self.effective_default(new_field)
<add> if old_default != new_default:
<add> if new_default is None:
<add> actions.append((
<add> self.sql_alter_column_no_default % {
<add> "column": self.quote_name(new_field.column),
<add> },
<add> [],
<add> ))
<add> else:
<add> actions.append((
<add> self.sql_alter_column_default % {
<add> "column": self.quote_name(new_field.column),
<add> "default": "%s",
<add> },
<add> [new_default],
<add> ))
<add> # Nullability change?
<add> if old_field.null != new_field.null:
<add> if new_field.null:
<add> actions.append((
<add> self.sql_alter_column_null % {
<add> "column": self.quote_name(new_field.column),
<add> },
<add> [],
<add> ))
<add> else:
<add> actions.append((
<add> self.sql_alter_column_null % {
<add> "column": self.quote_name(new_field.column),
<add> },
<add> [],
<add> ))
<add> # Combine actions together if we can (e.g. postgres)
<add> if self.connection.features.supports_combined_alters:
<add> sql, params = tuple(zip(*actions))
<add> actions = [(", ".join(sql), params)]
<add> # Apply those actions
<add> for sql, params in actions:
<add> self.execute(
<add> self.sql_alter_column % {
<add> "table": self.quote_name(model._meta.db_table),
<add> "changes": sql,
<add> },
<add> params,
<add> )
<ide><path>tests/modeltests/schema/tests.py
<ide> import copy
<ide> import datetime
<ide> from django.test import TestCase
<del>from django.db.models.loading import cache
<ide> from django.db import connection, DatabaseError, IntegrityError
<add>from django.db.models.fields import IntegerField, TextField
<add>from django.db.models.loading import cache
<ide> from .models import Author, Book
<ide>
<ide>
<ide> class SchemaTests(TestCase):
<ide>
<ide> models = [Author, Book]
<ide>
<add> # Utility functions
<add>
<ide> def setUp(self):
<ide> # Make sure we're in manual transaction mode
<ide> connection.commit_unless_managed()
<ide> def tearDown(self):
<ide> cache.app_store = self.old_app_store
<ide> cache._get_models_cache = {}
<ide>
<add> def column_classes(self, model):
<add> cursor = connection.cursor()
<add> return dict(
<add> (d[0], (connection.introspection.get_field_type(d[1], d), d))
<add> for d in connection.introspection.get_table_description(
<add> cursor,
<add> model._meta.db_table,
<add> )
<add> )
<add>
<add> # Tests
<add>
<ide> def test_creation_deletion(self):
<ide> """
<ide> Tries creating a model's table, and then deleting it.
<ide> def test_creation_fk(self):
<ide> pub_date = datetime.datetime.now(),
<ide> )
<ide> connection.commit()
<add>
<add> def test_create_field(self):
<add> """
<add> Tests adding fields to models
<add> """
<add> # Create the table
<add> editor = connection.schema_editor()
<add> editor.start()
<add> editor.create_model(Author)
<add> editor.commit()
<add> # Ensure there's no age field
<add> columns = self.column_classes(Author)
<add> self.assertNotIn("age", columns)
<add> # Alter the name field to a TextField
<add> new_field = IntegerField(null=True)
<add> new_field.set_attributes_from_name("age")
<add> editor = connection.schema_editor()
<add> editor.start()
<add> editor.create_field(
<add> Author,
<add> new_field,
<add> )
<add> editor.commit()
<add> # Ensure the field is right afterwards
<add> columns = self.column_classes(Author)
<add> self.assertEqual(columns['age'][0], "IntegerField")
<add> self.assertEqual(columns['age'][1][6], True)
<add>
<add> def test_alter(self):
<add> """
<add> Tests simple altering of fields
<add> """
<add> # Create the table
<add> editor = connection.schema_editor()
<add> editor.start()
<add> editor.create_model(Author)
<add> editor.commit()
<add> # Ensure the field is right to begin with
<add> columns = self.column_classes(Author)
<add> self.assertEqual(columns['name'][0], "CharField")
<add> self.assertEqual(columns['name'][1][3], 255)
<add> self.assertEqual(columns['name'][1][6], False)
<add> # Alter the name field to a TextField
<add> new_field = TextField(null=True)
<add> new_field.set_attributes_from_name("name")
<add> editor = connection.schema_editor()
<add> editor.start()
<add> editor.alter_field(
<add> Author,
<add> Author._meta.get_field_by_name("name")[0],
<add> new_field,
<add> )
<add> editor.commit()
<add> # Ensure the field is right afterwards
<add> columns = self.column_classes(Author)
<add> self.assertEqual(columns['name'][0], "TextField")
<add> self.assertEqual(columns['name'][1][6], True) | 4 |
Python | Python | fix py3 compatibility issues | 730bf06b38ce71de2a2bac406d5c87cea1795e46 | <ide><path>research/object_detection/builders/model_builder_test.py
<ide> def test_create_faster_rcnn_resnet_v1_models_from_config(self):
<ide> }"""
<ide> model_proto = model_pb2.DetectionModel()
<ide> text_format.Merge(model_text_proto, model_proto)
<del> for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
<add> for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.items():
<ide> model_proto.faster_rcnn.feature_extractor.type = extractor_type
<ide> model = model_builder.build(model_proto, is_training=True)
<ide> self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
<ide> def test_create_rfcn_resnet_v1_model_from_config(self):
<ide> }"""
<ide> model_proto = model_pb2.DetectionModel()
<ide> text_format.Merge(model_text_proto, model_proto)
<del> for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
<add> for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.items():
<ide> model_proto.faster_rcnn.feature_extractor.type = extractor_type
<ide> model = model_builder.build(model_proto, is_training=True)
<ide> self.assertIsInstance(model, rfcn_meta_arch.RFCNMetaArch)
<ide><path>research/object_detection/utils/config_util.py
<ide> def merge_external_params_with_configs(configs, hparams=None, **kwargs):
<ide>
<ide> if hparams:
<ide> kwargs.update(hparams.values())
<del> for key, value in kwargs.iteritems():
<add> for key, value in kwargs.items():
<ide> if key == "learning_rate":
<ide> _update_initial_learning_rate(configs, value)
<ide> tf.logging.info("Overwriting learning rate: %f", value) | 2 |
Javascript | Javascript | handle require.ensure errors well | 17329edcc930a286fac538522fca81256bb51659 | <ide><path>lib/dynamic.js
<ide> export function flushChunks () {
<ide> currentChunks = []
<ide> return chunks
<ide> }
<add>
<add>export class SameLoopPromise {
<add> constructor (cb) {
<add> this.onResultCallbacks = []
<add> this.onErrorCallbacks = []
<add>
<add> if (cb) {
<add> cb(
<add> (result) => this.setResult(result),
<add> (error) => this.setError(error)
<add> )
<add> }
<add> }
<add>
<add> setResult (result) {
<add> this.gotResult = true
<add> this.result = result
<add> this.onResultCallbacks.forEach((cb) => cb(result))
<add> this.onResultCallbacks = []
<add> }
<add>
<add> setError (error) {
<add> this.gotError = true
<add> this.error = error
<add> this.onErrorCallbacks.forEach((cb) => cb(error))
<add> this.onErrorCallbacks = []
<add> }
<add>
<add> then (onResult, onError) {
<add> const promise = new SameLoopPromise()
<add>
<add> const handleError = () => {
<add> if (onError) {
<add> promise.setResult(onError(this.error))
<add> } else {
<add> promise.setError(this.error)
<add> }
<add> }
<add>
<add> const handleResult = () => {
<add> promise.setResult(onResult(this.result))
<add> }
<add>
<add> if (this.gotResult) {
<add> handleResult()
<add> return promise
<add> }
<add>
<add> if (this.gotError) {
<add> handleError()
<add> return promise
<add> }
<add>
<add> this.onResultCallbacks.push(handleResult)
<add> this.onErrorCallbacks.push(handleError)
<add>
<add> return promise
<add> }
<add>
<add> catch (onError) {
<add> const promise = new SameLoopPromise()
<add>
<add> const handleError = () => {
<add> promise.setResult(onError(this.error))
<add> }
<add>
<add> const handleResult = () => {
<add> promise.setResult(this.result)
<add> }
<add>
<add> if (this.gotResult) {
<add> handleResult()
<add> return promise
<add> }
<add>
<add> if (this.gotError) {
<add> handleError()
<add> return promise
<add> }
<add>
<add> this.onErrorCallbacks.push(handleError)
<add> this.onResultCallbacks.push(handleResult)
<add>
<add> return promise
<add> }
<add>}
<ide><path>server/build/babel/plugins/handle-import.js
<ide> const TYPE_IMPORT = 'Import'
<ide>
<ide> const buildImport = (args) => (template(`
<ide> (
<del> typeof window === 'undefined' ?
<del> {
<del> then(cb) {
<del> eval('require.ensure = function (deps, callback) { callback(require) }')
<del> require.ensure([], (require) => {
<del> let m = require(SOURCE)
<del> m = m.default || m
<del> m.__webpackChunkName = '${args.name}.js'
<del> cb(m);
<del> }, 'chunks/${args.name}.js');
<del> },
<del> catch() {}
<del> } :
<del> {
<del> then(cb) {
<del> const weakId = require.resolveWeak(SOURCE)
<del> try {
<del> const weakModule = __webpack_require__(weakId)
<del> return cb(weakModule.default || weakModule)
<del> } catch (err) {}
<add> typeof window === 'undefined' ?
<add> new (require('next/dynamic').SameLoopPromise)((resolve, reject) => {
<add> eval('require.ensure = function (deps, callback) { callback(require) }')
<add> require.ensure([], (require) => {
<add> let m = require(SOURCE)
<add> m = m.default || m
<add> m.__webpackChunkName = '${args.name}.js'
<add> resolve(m);
<add> }, 'chunks/${args.name}.js');
<add> })
<add> :
<add> new (require('next/dynamic').SameLoopPromise)((resolve, reject) => {
<add> const weakId = require.resolveWeak(SOURCE)
<add> try {
<add> const weakModule = __webpack_require__(weakId)
<add> return resolve(weakModule.default || weakModule)
<add> } catch (err) {}
<ide>
<del> require.ensure([], (require) => {
<add> require.ensure([], (require) => {
<add> try {
<ide> let m = require(SOURCE)
<ide> m = m.default || m
<del> cb(m);
<del> }, 'chunks/${args.name}.js');
<del> },
<del> catch () {}
<del> }
<add> resolve(m)
<add> } catch(error) {
<add> reject(error)
<add> }
<add> }, 'chunks/${args.name}.js');
<add> })
<ide> )
<ide> `))
<ide> | 2 |
Javascript | Javascript | fix radius 0 | f5a2e394c86df31b6baf47cf22a1e3ac9194bd5c | <ide><path>src/elements/element.point.js
<ide> module.exports = function(Chart) {
<ide> return;
<ide> }
<ide>
<del> if (vm.radius > 0 || vm.borderWidth > 0) {
<add> if (!isNaN(vm.radius) && vm.radius > 0) {
<ide>
<ide> ctx.strokeStyle = vm.borderColor || Chart.defaults.global.defaultColor;
<del> ctx.lineWidth = vm.borderWidth || Chart.defaults.global.elements.point.borderWidth;
<add> ctx.lineWidth = helpers.getValueOrDefault(vm.borderWidth, Chart.defaults.global.elements.point.borderWidth);
<ide>
<ide> ctx.fillStyle = vm.backgroundColor || Chart.defaults.global.defaultColor;
<ide>
<del> var radius = vm.radius || Chart.defaults.global.elements.point.radius;
<add> var radius = vm.radius;
<ide>
<ide> var xOffset;
<ide> var yOffset; | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.