- Basics of npm: install Node.js and npm, know how to search and install a dependency locally to your project or a tool like
create-react-app
globally, and how to run scripts (npm start
,npm test
,npm run whatever
…) - ECMAScript new syntaxes and features we need and use are listed below (you'll benefit knowing them all, I just listed the ones you really use daily and inevitably with React), with links to Kangax tables which lists all those features and many more, with up to date links to Mozilla Developer Network documentation. Also see es6-features.org as a not pretty but efficient and concise introductio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Fragment, Component } from 'react'; | |
import ReactDOM from 'react-dom'; | |
class ContextData { | |
watchers = [] | |
constructor(initialState = {}) { | |
this.state = initialState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Works in every situations | |
function by_token ($src) { | |
$tokens = token_get_all($src); | |
$count = count($tokens); | |
$i = 0; | |
$namespace = ''; | |
$namespace_ok = false; | |
while ($i < $count) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
// Here is a simple function that reads a file and makes something with its content | |
function readLog1 (cb) { | |
// Notice how I even gave a name to my callback, this is useful for stack traces, everyone says… | |
fs.readFile('file-not-found.log', function onRead1 (err, content) { | |
// Usual error handling | |
if (err) return cb(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.argNames = function () { | |
// Extract function string representation: hopefully we can count on it ? | |
var s = this.toString(); | |
// The cool thing is: this can only be a syntactically valid function declaration | |
s = s // "function name (a, b, c) { body }" | |
.substring( // "a, b, c" | |
s.indexOf('(')+1, // ----------------^ | |
s.indexOf(')') // ------^ | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casperjs test test-checkbox.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original method | |
var object = { | |
method: function (x, y) { | |
return x+y; | |
} | |
} | |
// Add operations before or after! | |
object.method = (function (original) { | |
return function (x, y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNIT=MM | |
BORDER=NONE,#000000,0,MARKDOT,#000000 | |
GAP=5,5,ON | |
PAGE=210,297,PORTRAIT,HV | |
DPI=300 | |
CARDSIZE=63,88 | |
LINK=cards.xls,image | |
IMAGE=,[IMAGE],0,0,100%,100%,0,PTA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNIT=MM | |
BORDER=NONE,#000000,0,MARKDOT,#000000 | |
GAP=10,10,ON | |
PAGE=210,297,PORTRAIT,HV | |
DPI=300 | |
CARDSIZE=40,55 | |
LINK=cards.xls,image | |
IMAGE=,[IMAGE],0,0,100%,100%,0,PTA |