Here are some strategies for learning that scientists and psychologists have found to be effective.
Try to do more active learning than passive learning as it is more effective.
Passive | Active |
---|
module.exports = function (file, api, options) { | |
const useDouble = options.useDouble || false; | |
const noSemi = options.noSemi || false; | |
const useRequire = options.useRequire || false; | |
const j = api.jscodeshift; | |
const isContainsLodashImport = | |
file.source.match(/(const|let|var)\s+_\s+=\s+require\(["']lodash["']\)/g) || | |
file.source.match(/import\s+_\s+from\s+["']lodash["']/g); |
let viewport = document.body.getBoundingClientRect() | |
let maxWidth = viewport.width | |
let maxHeight = viewport.height | |
let outer = document.createElement('div') | |
outer.style = "position: absolute; top: 0; left: 0; right: 0;" | |
for (let i = 0; i <= 40; i++) { | |
outer.append(makeImg()) | |
} |
// node_modules/5to6-codemod/transforms/amd.js | |
/** | |
* amd - Replace define([]) calls with es6 import/exports | |
*/ | |
var util = require('../utils/main'); | |
export default function transform(file, api, options) { | |
var j = api.jscodeshift; |
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; |
"use strict"; | |
module.exports = { | |
extends: [ | |
"eslint:recommended", | |
"prettier" | |
], | |
rules: { | |
"arrow-parens": "error", | |
"brace-style": ["error", "1tbs", { "allowSingleLine": false }], |
> function foo(arg1, arg2, arg3) { | |
if (arguments.length === 2) { | |
arg3 = arg2 | |
} | |
console.log('arg1', arg1) | |
console.log('arg2', arg2) | |
console.log('arg3', arg3) | |
} | |
undefined | |
> foo(1, 2, 3) |
# Make sure you've got the latest as-coffee-base and master branches | |
$ git fetch | |
# Get set up with the branch you want to decaffeinate | |
$ git checkout <MY-BRANCH> | |
# Rebase it, so it's branched from the changes just before decaffeinating | |
$ git rebase origin/as-coffee-base | |
# Run the decaffeination on your branch. You need to be on a version of npm with `npx` available, which I think is default from at least Node 8 onwards. I did this on node 8.4.0 installed via nvm. I think you also need prettier installed in advance. | |
$ npm install -g prettier prettier-eslint | |
# The script also requires `zsh` to run, which can be installed via brew or apt. | |
$ ./decaffeinate.sh |
import React, { Component } from 'react' | |
import Search from './Search.js' | |
import SearchResults from './SearchResults.js' | |
import NewBooking from './NewBooking.js' | |
export default class Bookings extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { | |
searchVal: '', |
import React, { Component } from "react"; | |
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | |
import "./ranking.css"; | |
class Ranking extends Component { | |
// | |
render() { | |
console.log(this.props.articles); |