├── README.md ├── courses ├── core │ ├── 1-html-and-css-foundations.md │ ├── 10-es6.md │ ├── 11-http.md │ ├── 12-http-apis.md │ ├── 13-http-apis-in-javascript.md │ ├── 14-react.md │ ├── 2-bootstrap.md │ ├── 3-javascript-foundations.md │ ├── 4-git-and-github.md │ ├── 5-jquery.md │ ├── 6-node-quickly.md │ ├── 7-sass.md │ ├── 8-webpack.md │ └── 9-bootstrap-with-sass.md └── side-quests │ ├── a-advanced-html-and-css.md │ ├── b-css-layouts-and-flexbox.md │ ├── c-underscore-and-lodash.md │ ├── d-react-native.md │ ├── e-bash.md │ └── f-backend-dev.md ├── resources ├── bash-cheat-sheet.md ├── command-line-cheat-sheet.md ├── git-cheat-sheet.md ├── jargon-buster.md └── npm-cheat-sheet.md └── tasks └── 1-javascript-tasks.md /README.md: -------------------------------------------------------------------------------- 1 | # Become a web developer 2 | 3 | This training resource is designed with the goal of training someone with no programming experience to become a frontend web / app developer as quickly as possible. 4 | 5 | The course is designed around 'Abilities' and grouped into courses. The scheme is opinionated, and covers just enough to get a foothold as a frontend developer. 6 | 7 | Courses typically consist of hand picked material from the internet. Suplimented with any other relevant information and some tasks. 8 | 9 | ## Abilities 10 | 11 | * Build static website with basic styling 12 | * [HTML and CSS foundations](courses/core/1-html-and-css-foundations.md) 13 | 14 | * Building a static website with some nice styling (no control of styling) 15 | * [Bootstrap](courses/core/2-bootstrap.md) 16 | 17 | * Collaborating with others 18 | * [Git / Github](courses/core/4-git-and-github.md) 19 | 20 | * Building a static website with some nice styling which is controlled 21 | * [Sass](courses/core/7-sass.md) 22 | * [Npm (and require)](courses/core/6-node-quickly.md) 23 | * [Webpack for 'building' a codebase](courses/core/8-webpack.md) 24 | * [Bootstrap with Sass](courses/core/9-bootstrap-with-sass.md) 25 | 26 | * Building an interactive website (2010 style!) 27 | * [Javascript Foundations](courses/core/3-javascript-foundations.md) 28 | * [JQuery](courses/core/5-jquery.md) 29 | 30 | * Accessing external data via HTTP JSON APIs 31 | * [HTTP](courses/core/11-http.md) 32 | * [HTTP APIs](courses/core/12-http-apis.md) 33 | * [HTTP API library (Superagent)](courses/core/13-http-apis-in-javascript.md) 34 | 35 | * Building an interactive website (2015 style!) 36 | * [ES6/7](courses/core/10-es6.md) 37 | * [React](courses/core/14-react.md) 38 | * Routing (React router? pages.js) 39 | 40 | ## Side Quests 41 | 42 | * [Advanced HTML and CSS](courses/side-quests/a-advanced-html-and-css.md) 43 | * [CSS Layouts and Flexbox](courses/side-quests/b-css-layouts-and-flexbox.md) 44 | * [Underscore / Lodash](courses/side-quests/c-underscore-and-lodash.md) 45 | * [React-Native](courses/side-quests/d-react-native.md) 46 | * [Bash and Linux](courses/side-quests/e-bash.md) 47 | * [Backend Development](courses/side-quests/f-backend-dev.md) 48 | -------------------------------------------------------------------------------- /courses/core/1-html-and-css-foundations.md: -------------------------------------------------------------------------------- 1 | #HTML and CSS foundations 2 | 3 | # Outcome 4 | 5 | You'll be able to build a static website, control where things go on the page and change the look and feel of things on the page. 6 | 7 | You'll understand: 8 | 9 | * The syntax and layout of HTML, most of the HTML `` and what they're used for. 10 | * What CSS is, and the different things you can do with it. 11 | 12 | # Prerequisites 13 | 14 | * Text editor (Sublime) 15 | * Web browser (Chrome) 16 | * Code School subscription 17 | * Codecademy account. 18 | 19 | # Advice 20 | 21 | You can watch codeschool videos faster than x1 if you want to. 22 | 23 | HTML 5 and CSS 3 are the latest versions. But HTML and CSS are continually improved in modern browsers so the numbers aren't important. Just use the latest / best features. 24 | 25 | ### HTML 26 | 27 | HTML is old and all the browsers have to support it. As a result the tag names e.g. `
` make no sense :smile:. You just have to learn them... 28 | 29 | ### CSS 30 | 31 | Opinion: The 'box model' is old and very difficult to reason about. There's a newer model called the flex-box model which I find much easier :smile:. 32 | 33 | Opinion: `float`, `block` and `inline` are hard and getting something to layout how you want it is surprisingly hard. 34 | 35 | He talks alot about 'resetting' the css to override the browser defaults. There are tools / libraries to help with this, you wouldn't do it manually. 36 | 37 | # Learning materials 38 | 39 | # Core 40 | 41 | * [Code School Front End Foundations Course](https://www.codeschool.com/courses/front-end-foundations/) (Level 1-5) 42 | 43 | ## Alternative 44 | 45 | * [Codeacademy](https://www.codecademy.com/courses/web-beginner-en-HZA3b/) No videos, learn by doing. 46 | 47 | * [Shayhowe](http://learn.shayhowe.com/html-css/). All reading and visual. 48 | 49 | * [Another reading example](http://websitesetup.org/html5-beginners-guide/) 50 | * 51 | ## Additional / useful 52 | 53 | * [HTML Cheatsheet](http://www.simplehtmlguide.com/cheatsheet.php) (Might be a better one out there) 54 | 55 | * [CSS Cheatsheet](http://adam-marsden.co.uk/css-cheat-sheet/) 56 | * [Another cheatsheet](http://websitesetup.org/html5-cheat-sheet/) (Wish it was just a website). 57 | # Tasks 58 | 59 | * Run through the core learning materials + tasks. 60 | * [Codecademy problems](https://www.codecademy.com/en/courses/html-css-prj) 61 | * Broadway 62 | * Innovation Cloud 63 | * Move 64 | * Get one of the above Codecademy courses to work on your laptop locally. 65 | 66 | ## Optional tasks 67 | 68 | * [Make recent Airbnb site from scratch](https://www.codecademy.com/en/skills/make-a-website/) 69 | -------------------------------------------------------------------------------- /courses/core/10-es6.md: -------------------------------------------------------------------------------- 1 | # ES6 / ES2015 & ES7 2 | # Outcome 3 | 4 | You'll: 5 | 6 | * Understand what ES6 (ES 2015 or ES.next) is. 7 | * Be using ES6 by default in your code. 8 | * Have an appreciation for ES7 9 | 10 | # Prerequisites 11 | 12 | * Javascript ES5. 13 | 14 | # Advice 15 | 16 | Javascript has a poor reputation for a programming language. ES6 is a masssive step forward to making things 'proper'. It will make your coding more concise more readible. It will also help you when you come to learn other languages (most of the features are borrowed from elsewhere.) 17 | 18 | Browsers don't support ES6 natively ([they do support some features](https://kangax.github.io/compat-table/es6/)), so we have to transpile ES6 -> ES5 for compatability in older browsers. To do this there is a tool called [Babel](https://babeljs.io/) (it's already in all our webpack projects :smile:). 19 | 20 | # Learning materials 21 | 22 | # Core 23 | 24 | * [ES6 Features](https://github.com/lukehoban/es6features#readme) 25 | * [ES7 Features](https://github.com/hemanth/es7-features#readme) 26 | 27 | # Tasks 28 | 29 | * Take a look at theese ES6 Features we'll be using. 30 | * let 31 | * arrows 32 | * template strings 33 | * modules 34 | * destructuring 35 | * default + rest + spread (For React mainly) 36 | * classes 37 | * Object rest properties (ES7) (For React mainly) 38 | * Object spread properties (ES7) (For React mainly) 39 | * For each feature, build an example of it working and look at the ES5 code that gets generated. 40 | -------------------------------------------------------------------------------- /courses/core/11-http.md: -------------------------------------------------------------------------------- 1 | # HTTP 2 | # Outcome 3 | 4 | You'll: 5 | 6 | * Understand some of the finer points of HTTP 7 | 8 | # Advice 9 | 10 | HTTP is the 'protocol' used to load webpages. It's a standard agreed by a bunch of people with neck beards come up with, developers who do httpy stuff (Firefox / Chrome developers etc.) then follow those standards. 11 | 12 | It's worth noting that HTTP is [Synchronous](http://stackoverflow.com/questions/748175/asynchronous-vs-synchronous-execution-what-does-it-really-mean), so when you fire off a HTTP request, you wait for the response, there is a persistent connection. If your internet is disrupted in the mean time, you'll most likely get an error. 13 | 14 | HTTP calls can return data in many any file format. 15 | e.g: 16 | 17 | * http://google.com will return HTML which your browser understands and does stuff with. 18 | * http://textfiles.com/100/914bbs.txt is a text file. 19 | * https://upload.wikimedia.org/wikipedia/commons/e/e9/Felis_silvestris_silvestris_small_gradual_decrease_of_quality.png is a png file. 20 | 21 | You can invoke HTTP over the command line. The two most popular are `curl` and `wget`. Curl is a pain to use: [this helps me](https://curlbuilder.com/). Try `curl -XGET 'http://www.google.co.uk'`. 22 | 23 | Redirection is quite important, it's very common to do these redirects 24 | * http -> https (secure is good :smile:). 25 | * http://google.com -> http://www.google.com. 26 | 27 | # Learning materials 28 | 29 | # Core 30 | 31 | * [HTTP primer](http://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part-1--net-31177) 32 | 33 | 34 | # Tasks 35 | 36 | * Read the primer but stop at the section: Request and Response Message Formats 37 | * Questions (answers on a postcard!) 38 | * Draw a sample url from memory and label each bit. 39 | * What happens if you specify no port on your url? e.g. http://google.com 40 | * Do me two query parameters: name which should be "john" and age which should be 20. 41 | * What verbs are there? 42 | * Which verb does a web browser when you load a page? 43 | * What goes into a request? 44 | * What is in a response? 45 | 46 | -------------------------------------------------------------------------------- /courses/core/12-http-apis.md: -------------------------------------------------------------------------------- 1 | # HTTP API 2 | # Outcome 3 | 4 | You'll: 5 | 6 | * Understand how people use HTTP to write remote APIS 7 | 8 | # Advice 9 | 10 | Initially HTTP was used only for websites. But then some bright spark decided to also use it for 'APIs'. 11 | 12 | ### WTF is API? 13 | 14 | API is a horribly overriden term. It's quite general. Loosely it means: 'When i'm programming and do this. This will happen.'. It refers to a collection of local or remote function calls. 15 | 16 | I found it really hard to define properly, so here are some examples. 17 | 18 | * jQuery has an api. It's the desciption of all the functions jQuery has. 19 | * One part of that api would be: `$('my-class') #Will select all elements in the DOM which have .my-class and return all the HTML elements that match.` 20 | * javascript doesn't have an api because it's not a library / framework, it's a programming language. I don't know why, but you wouldn't say 'javascript's api' to refer to the `+` operator. It's just part of the language. It's only things built on top of programming languages which have APIS. (1) 21 | * http://ws.spotify.com/search/1/artist.json?q=kate%20bush is an api. Because it takes parameters and returns structured data. 22 | * http://google.com is not an api, because it doesn't return computer readable structured data. (It does take parameters though! e.g. https://google.com/?q=hello+john) 23 | 24 | So having thought about it more maybe: An API is a way of describing something which is conceptually like a 'function'. It takes parameters or data in and returns data out in a format a computer can easily understand. 25 | 26 | Some of these APIs run locally e.g. jQuery. They execute all within your programming language and return data in your programming language e.g. an int or a string. 27 | 28 | Some of these APIs run remotely e.g. http apis. You send a http message across the network to another process, which interprets the message. Runs a function and then sends a structured message back with the response. 29 | 30 | ###Why are remote API calls a good idea? 31 | 32 | Cons: 33 | 34 | * Unreliable? If network breaks, API breaks. 35 | * HTTP uses something called TCP. Which helps with little mini failures. (2) 36 | * Slower, networks are 'IO' (Input Output). IO is always slowest bit. 37 | 38 | Pros: 39 | 40 | * Keeping things secret 41 | * If you've written some code which does something that other people find hard to program a solution to and is useful. Then you're probably a millionaire. Keeping it secret is useful :smile:. 42 | * When you host a HTTP api, you just open up one port e.g. port 80 for HTTP traffic. This does not allow people to see you code. They just know what they can do with the API and what it will return. They have no idea / access to how it works. It's a 'black box'. 43 | * Powerful hardware 44 | * If someone loads an app on their smartphone and it tries to locally compute some really complex thing it's going to be slow. Instead you can query a http api and let a MASSIVE server do this for you :) . 45 | * Scalability 46 | * You could host your HTTP API on a single Core 2 duo server with 4GB of ram. But when you have a lot of users you might face 1000 HTTP requests per minute. At some point, your server will not cope and the requests will take longer. At some point some people won't even get responses any more (a HTTP timeout). 47 | * With HTTP APIs you can host 2x Core 2 Duo server with 4GB of ram. You then put a very lightweight, industrial strength HTTP server at the front which simply diverts requests on to one of the two. This is called a load balancer. NGINX and HA-Proxy are the big ones. 48 | * Keeping things REALLY seperate (and reusable) 49 | * If you put all your code all in one project it tends to grow and grow and eventually becomes a steaming mess. Some people think that splitting things out might help. (This is a hard topic.) 50 | * Using various programming languages 51 | * Different programming languages have different strengths / weaknesses (3). You might wish to use a different language for a particular part of your app. You could split your http api over 3 languages. 52 | 53 | When talking about HTTP APIs another word that's bounded around alot is REST. It's basically a convention on how to structure which HTTP verbs (GET, POST, PUT etc.) you use depending on what you're doing. It's probably a good idea to roughly follow rest. But realistically HTTP APIs are just a way of remote calling a function. It's a good idea that those APIS 'don't have state' and are predictable. It would be bad if you called a GET HTTP API once, and this affected the response of the second call. 54 | 55 | ###Why HTTP APIs though? 56 | 57 | This has really kicked off in the last 5 years. The primary reason is that the web sandbox only allows you to call out to things using the HTTP protocol. Alot of technologies in the last 10 years became popular and then became standard because websites are very popular (obviously). And the restrictions of the web haven't really changed, so in the end people found ways to make these things good. E.g. Javascript (which was truly awful 10 years ago). And HTTP for APIs, which would have made you sound mad 10 years ago. Once the tools / online resources became available people then started using them where they didn't even need to (desktop apps / mobile apps). 58 | 59 | ###So what is standard? 60 | 61 | Restful(ish) HTTP APIS which return JSON as the response format. You can also return XML, both are machine readible. JSON is more human readable, which has made JSON popular. 62 | 63 | #### When you might not use HTTP 64 | 65 | You care about performance e.g. games, torrents, skype. These are probably going to use something which operates using UDP. There is a new thing I know nothing about called webrtc that I think does this for websites (appear.in uses it I think). 66 | 67 | If you want asynchronous communications e.g. a push notification. Then HTTP has not got your back. Websockets is a relatively recent addition to browsers that can do it. For example when a hangout comes in and Gmail pops it open, that's probably websockets. 68 | 69 | Async is more complicated to code and reason about than sync. So use sync unless you need async. 70 | 71 | #### When might you not use JSON 72 | 73 | You need to be super-careful about checking the format of data in or out. Banks are reknowned for using XML (which can have a 'schema' with it, which lays out rules for what is / isn't allowed). XML is just not great IMO. I'd rather use JSON and write some code to validate it's correct... 74 | 75 | You care about the size of the data you're sending around. JSON is human readible, but it's not compressed at all. There are formats which compress it down to binary and back again in a repeatable way. 76 | 77 | * [BSON (binary JSON)](https://en.wikipedia.org/wiki/BSON) 78 | * [Profobuf (by google)](https://developers.google.com/protocol-buffers/?hl=en) 79 | * [Thrift (by twitter)](https://thrift.apache.org/) 80 | 81 | But to use these, you need a library with can 'parse' and 'serialize' these formats. Debugging messages is also impossible without serializing the messages back to a human readible form. 82 | 83 | # Learning materials 84 | 85 | # Core 86 | 87 | * [HTTP API Primer](http://code.tutsplus.com/tutorials/a-beginners-guide-to-http-and-rest--net-16340) 88 | 89 | 90 | # Tasks 91 | 92 | * Read the primer 93 | * Read the advice. 94 | * Compare [JSON api call](http://ws.spotify.com/search/1/artist.json?q=kate%20bush) to [XML api call](http://ws.spotify.com/search/1/artist?q=kate%20bush) 95 | * Download [Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en) and use it to call this api: http://ws.spotify.com/search/1/artist.json?q=kate%20bush 96 | 97 | # Footnotes 98 | 99 | (1) The `+` operator is really just a special function if you think about it. var + = function(a,b) { .... }. It's just that you don't say: `+(1, 2)` you say `1 + 2`. 100 | 101 | Some languages (e.g. scala) let you write functions which can be used 'infix' like this. e.g. `infix var add = function(a,b) { a + b }; 1 add 2;` This allows you to write more mathematical operators and stuff. Mental. 102 | 103 | (2) 104 | 105 | [http://www.diffen.com/difference/TCP_vs_UDP](TCP vs UDP). TCP is slower and has more guarentees than UDP. UDP is faster as a result. You would always use something with TCP unless you had performance requirements. When you play DOTA, it will probably use TCP to find a match / manage you friends list, but when it's sending you information about hero movements, that's UDP. Skype will work with UDP. 106 | 107 | (3) 108 | 109 | Interestingly, no one language seems to have nailed everything. There is nearly always a trade off of some sort. 110 | 111 | C and C++ are really fast, but super hard to understand as a human being. 112 | Ruby on Rails is quick to program, but has pretty bad performance. 113 | etc. 114 | 115 | Whatsapp wrote their code in Erlang (which is super good at messagey stuff), they sold to Facebook for $18B with just ~20 devs on staff. Their success was probably largely based around picking the right programming language for the job :smile:. Mental. 116 | -------------------------------------------------------------------------------- /courses/core/13-http-apis-in-javascript.md: -------------------------------------------------------------------------------- 1 | # HTTP APIs in Javascript 2 | # Outcome 3 | 4 | You'll: 5 | 6 | * Understand how to grab data from HTP apis in javascript code 7 | 8 | # Advice 9 | 10 | ### How this works 11 | 12 | User opens your website. HTML, CSS and Javascript is downloaded. Javascript starts executing. You javascript code then makes what some people call an 'AJAX' request to get data from a HTTP API. 13 | 14 | There are low level functions to do this in the browser: `XMLHttpRequest`. They're quite horrible. 15 | 16 | ### How we do it 17 | Instead we'll use a library. The nicest library for doing this IMO is [SuperAgent](http://visionmedia.github.io/superagent/). Super agent uses a [fluid interface](https://en.wikipedia.org/wiki/Fluent_interface). Where you chain loads and loads of methods together to make everything very readible. 18 | 19 | ### JSON deserializing / serializing 20 | 21 | With any data format (json, xml, etc.) there are two common operations we can do them. 22 | 23 | ####Serialize (marshal, stringify, to_string) 24 | 25 | Converts an object into a string. 26 | 27 | ``` 28 | JSON.stringify({a: 1}) 29 | 30 | => '{"a": 1}' 31 | ``` 32 | 33 | ####Parse (unmarshal, deserialize) 34 | 35 | Converts a string into an object. 36 | 37 | ``` 38 | JSON.parse('{"a": 1}') 39 | 40 | => {a: 1} 41 | ``` 42 | 43 | Data goes across the network in serialized (string) form. So each time we get some data across the wire it would come in raw (string) and need deserializing. (Some libraries do this automatically (SuperAgent does)) 44 | 45 | # Learning materials 46 | 47 | # Core 48 | 49 | * [SuperAgent](http://visionmedia.github.io/superagent/) 50 | 51 | # Tasks 52 | 53 | * Skim through the Super Agent docs 54 | * Query the spotify api in code and display the results on the page using jQuery: http://ws.spotify.com/search/1/artist.json?q=kate%20bush 55 | -------------------------------------------------------------------------------- /courses/core/14-react.md: -------------------------------------------------------------------------------- 1 | # React 2 | # Outcome 3 | 4 | You'll: 5 | 6 | * Understand what react is and be able to make interactive web apps with it. 7 | * Understand what JSX is. 8 | * Why you learned everything else :) (Webpack, ES6, Lodash, SuperAgent) (Cos they work amazingly with React) 9 | 10 | # Advice 11 | 12 | ##JSX 13 | 14 | JSX is important with React. We'll always use it. JSX is another transpiled language (like we do for ES6 -> ES5 code). JSX lets you write HTML directly in javascript. That's it. 15 | 16 | ``` 17 | var someHtml =
Hi Buddy
18 | ``` 19 | 20 | We'll use webpack to do the transpilation. 21 | 22 | JSX doesn't quite generate a string. I think it generates DOM javascript 'objects'. You can check for yourself in the debugger. 23 | 24 | ### Differences from normal HTML 25 | 26 | #### Attribute names are different 27 | 28 | They're camel cased by convention (instead of dashed). Sometimes they're a tiny bit different, but React normally just tells you the problem and the fix in the console :). [Read more](https://facebook.github.io/react/docs/tags-and-attributes.html) 29 | 30 | `` -> `` 31 | 32 | #### You can write Javascript inside your HTML. 33 | 34 | JSX works just like normal HTML unless you do one thing. If you put `{}` then inside the brackets you go back to javascript. 35 | 36 | ``` 37 | var x = 1 38 | var someHtml =
{x + 1}
39 | ``` 40 | 41 | ``` 42 | var buttonClass = 'btn btn-primary' 43 | var button = 44 | ``` 45 | 46 | *Exception* 47 | It's quite rare to use it though. 48 | ``` 49 | var elementType = 'div' 50 | var someHtml = 51 | ``` 52 | 53 | ##React 54 | 55 | React is a javascript library which helps build more complex interactive UIs. It helps you build 'views' (User Interfaces) which change as inputs come in (e.g. data from a http api, or a user clicking things). 56 | 57 | It provides about 5 important APIs, that you need to understand well. And a bunch of less important things you can learn as you go. 58 | 59 | Important APIs: 60 | 61 | ###React.render 62 | 63 | ``` 64 | React.render(

Hello

, document.getElementById('content')); 65 | ``` 66 | In the order javascript evalulates it: 67 | 68 | * `

Hello

` is JSX for the html `"

Hello

"` 69 | * `document.getElementById('content')` is equivalent to `$('#content')` in jquery. But without jQuery cos you probably wouldn't mix up your react and jQuery. 70 | * So this whole thing is pretty much like: `$('#content').replace(

Hello

)` 71 | 72 | 73 | ###React.createClass (React Components) 74 | 75 | `React.createClass` is how you define a 'component'. Components is the only idea in React. They can have [different functions defined inside them](https://facebook.github.io/react/docs/component-specs.html): e.g. `render`, `componentWillMount`. 76 | 77 | Components are 'defined' (once), 'created' (0 or more times). Once a component is 'created' it 'lives' for a period of time (whilst the user has the website open?). 78 | 79 | The functions inside the component definition are called at certain points in a components life. 80 | 81 | ####Defining a component 82 | ``` 83 | var myComponent = React.createClass({ 84 | render: function() { 85 | return ( 86 | I am a button! Click me! 87 | ); 88 | } 89 | }) 90 | ``` 91 | We will be putting each component in it's own file (and `module.export`ing it for use else where.) 92 | ####Creating (instantiating) a component 93 | You can then write: ``. So you can basically define your own html tags. E.g. `` which would render a dota hero. You can reuse it anywhere. 94 | 95 | ###render 96 | 97 | `render` is a function which returns JSX. The component will call the render function whenever it wants to know: 'What does this component currently look like at this point in its life.'. It will take the output of the `render` function and put it into the browser (it updates the DOM automatically every time it calls the render function). 98 | 99 | Every component *Must* have a `render` function. 100 | 101 | ###Props (properties -> could be called 'arguments' really) 102 | 103 | Props are properties that get 'passed in' to the component when it's created. 104 | 105 | Props are *immutable* - they can never change. 106 | 107 | ####Passing props in 108 | 109 | `` 110 | 111 | Here we pass a prop called `name` into the hero with the value `'Puck'`. 112 | 113 | ####Talking about props inside the component 114 | 115 | Inside any of the functions we pass into `createClass` e.g. `render`. We can access the prop using `this.props.name`. 116 | 117 | `this.props` is an object with all the props in. e.g. `{name: 'Puck'}` 118 | ``` 119 | var hero = React.createClass({ 120 | render: function() { 121 | return ( 122 |
{this.props.name}
123 | ); 124 | } 125 | }) 126 | ``` 127 | I'm aware that `this` has just randomly just popped up on you :p . This is because components are conceptially a 'Class' and we're straying into Object Oriented Programming (OOP), which is quite famous / popular. This is a tricky concept which we will cover fully later, I think you can program React without really understanding it fully. (I know not understanding stuff fully kind of sucks though :( ) 128 | 129 | ###State 130 | 131 | State very similar to props, except for it's not immutable - so they can change over time. 132 | 133 | You should favour props where possible. Cos things not changing is easier to reason about in a programmers mind. 134 | 135 | 136 | ####Setting state 137 | 138 | #####getInitialState function 139 | 140 | ``` 141 | var hero = React.createClass({ 142 | getInitialState: function() { 143 | return {name: 'unknown'} 144 | }, 145 | 146 | render: function() { 147 | return ( 148 |
{this.state.name}
149 | ); 150 | } 151 | }) 152 | ``` 153 | #####setState function 154 | In any of the functions inside the component. You can say `this.setState({name: 'Danger Mouse'})`. 155 | 156 | Any time you change the state of a component React will call the `render` function again and update the component automatically on the screen. 157 | 158 | Do not set state like this: `this.state = {name: 'Danger Mouse'}`. It won't call the `render` function, and might just completely break everything. 159 | 160 | ####Talking about state inside the component 161 | 162 | Inside any of the functions we pass into `createClass` e.g. `render`. We can access the state (which is also an object like props) using `this.state`. 163 | 164 | ###componentWillMount 165 | 166 | `componentWillMount` is a function you define inside your component. It gets called when you create your component. Use it to do stuff before your component is shown on the screen. 167 | 168 | ###componentDidMount 169 | `componentDidMount` is a function you define inside your component. It gets called a little after `componentWillMount`. Use it to do stuff before your component is shown on the screen. 170 | 171 | 172 | ##How to think about React 173 | 174 | * React is a library which lets you create new HTML tags (components) e.g: ``. 175 | * React components are essentially: `props` (immutable) + `state` (can change) and a `render` function which probably talks about `props` and `state`. 176 | * Think of react as: `function render(props, state) { return(
{this.props.name} {this.state.somethingElse}) }` 177 | * This function gets called every time state changes and will automatically update the DOM. 178 | 179 | # Learning materials 180 | 181 | # Core 182 | 183 | * [React Primer](https://github.com/mikechau/react-primer-draft) 184 | * [React Frontend Masters](https://frontendmasters.com/courses/react/) 185 | * [Official Docs](https://facebook.github.io/react/docs/getting-started.html) bit crap in my opinion. They're good once you understand React enough to get stuff done, but not amazing for learning IMO. 186 | 187 | # Tasks 188 | 189 | Do it like throwing Spaghetti at wall. Feel free to jump backwards, re-read, re-watch, play around until you get it. 190 | 191 | * Read my Advice. 192 | * Skim the Primer. 193 | * Watch frontend masters react course. 194 | * Do the [tasks](https://docs.google.com/document/d/1GfyOXSaBuvjIsNMh31gKfED_q7H-_3muY9xuRgStjQY/edit?usp=sharing) 195 | -------------------------------------------------------------------------------- /courses/core/2-bootstrap.md: -------------------------------------------------------------------------------- 1 | #Bootstrap 2 | 3 | # Outcome 4 | 5 | You'll: 6 | 7 | * Be able to get decent default styling on your web pages 8 | * Understand what 'responsive' means and how make your page responsive it. 9 | * Less precise but useful layout techiques 10 | * Be able to build lots of components you can see all over the web 11 | * How to include icons onto your page 12 | 13 | # Prerequisites 14 | 15 | * [html and css foundations](1-html-and-css-foundations.md) 16 | 17 | Bootstrap is a great tool when you're starting out. When you get more advanced you might move away from it (i'm not that advanced yet!). 18 | 19 | Embrace the grid for nearly everything you do. 20 | 21 | Use it to 'reset' the browser defaults (which are truly awful). 22 | 23 | We're going to learn how to customise Bootstrap in a later course, you can modify the default fonts, and colours it uses :smile: 24 | 25 | [Bootstrap v4](http://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/) is coming quite soon. But we'll use 3 for now. 26 | 27 | # Learning materials 28 | 29 | # Core 30 | 31 | * [Code School Blasting off with bootstrap](https://www.codeschool.com/courses/blasting-off-with-bootstrap) (All levels) 32 | 33 | * [Bootstrap](http://getbootstrap.com/) documentation [css](http://getbootstrap.com/css/) and [components](http://getbootstrap.com/components/) are particularly useful 34 | 35 | ## Alternative 36 | 37 | ## Additional / useful 38 | 39 | # Tasks 40 | 41 | * Run through the code school course + tasks. 42 | * [Codecademy problems](https://www.codecademy.com/en/courses/html-css-prj) 43 | * Do shutterbug through to headlines (and everything in-between :smile:) (If this is taking ages, maybe stop!) 44 | * Get headlines to work locally on your laptop. 45 | * Build a demo site locally with: 46 | * 3 bootstrap [css](http://getbootstrap.com/css/) features you've yet to use in the above. 47 | * 3 bootstrap [component](http://getbootstrap.com/components/) features you've yet to use in the above. 48 | -------------------------------------------------------------------------------- /courses/core/3-javascript-foundations.md: -------------------------------------------------------------------------------- 1 | #Javascript Foundations 2 | 3 | Warning: This course is long. It's 4 code school courses. But once you're done, you'll understand everything you need to know about Javascript :smile:. 4 | 5 | # Outcome 6 | 7 | You'll: 8 | 9 | * Understand the majority of the features of the Javascript language. 10 | * Be ready to learn how to make interactive web pages. 11 | 12 | # Prerequisites 13 | 14 | * [html and css foundations](1-html-and-css-foundations.md) 15 | 16 | # Advice 17 | 18 | * Javascript has versions (although Chrome, for example, tends to release them feature by feature all the time). Version ES5 is the current version, but ES6 is a lot better :smile: 19 | * The code school courses are based on ES5. 20 | * He says semi colons are necessary and semi colons are good. They're not necessary anymore in modern javascript. 21 | * These days we don't tend not to use `while` loops or `for` loops. We'll use arrays and a collections library instead (Like `.map`). You'll learn this soon. 22 | * `undefined` and `null` are a pain. There are some libraries which help us do `undefined` and `null` checking later :smile: 23 | 24 | * Javascript (Especially ES5) has a lot of things programmers don't like / find hard. ES6 helps alot of these things. 25 | * Variable scope 26 | * When you load a .js file `