Skip to content

Instantly share code, notes, and snippets.

@oampo
oampo / exercise-4.md
Last active September 28, 2016 00:18

Loading and saving the Trello state

Loading the state

  • Import and apply the Redux Thunk middleware

  • Add some initial content to the db.json file:

    {

"lists": [{

Connect the components, dispatch the actions

Rendering the state

  • In your ReactDOM.render call, wrap your components in a Provider to provide the store to connected components.
  • Connect the Board component, mapping the lists property of the state to the lists prop of the board component.
  • Check that your initial state is being rendered at this point.

Adding cards

@oampo
oampo / exercise-2.md
Last active September 26, 2016 14:28

Create actions, reducers and a store

  • In js/actions/index.js make action creators for the following actions:

    {
        type: 'ADD_CARD',
        // Should be variable
        card: {
            id: 0,                  // The ID of the card
    
@oampo
oampo / exercise-1.md
Last active September 26, 2016 13:53

Create stateless Trello components

  • Add a main <div> to index.html.
  • In the js/components repository, create the four stateless components described below.
  • As you complete each component, render them into the <div> by adding a ReactDOM.render line to js/index.js.

Components

<Card />

@oampo
oampo / index.js
Created August 19, 2015 10:21
ISS Finder M1
var axios = require('axios');
var findPassTime = function(latitude, longitude) {
return axios.get('http://api.open-notify.org/iss-pass.json', {
params: {
lat: latitude,
lon: longitude
}
})
@oampo
oampo / local.js
Created June 10, 2014 15:12
Local #crumbs #draft
var Local = function() {
var path = document.location.pathname.split("/");
path = path[4];
var ajax = $.ajax({
url: "/" + path + "/files"
});
ajax.done(this.onGetFiles.bind(this));
this.data = {
description: decodeURI(path) + "#no-index #crumbs",
@oampo
oampo / about.md
Created June 9, 2014 10:42
About #no-index #crumbs
@oampo
oampo / cold_mountain.html
Created June 6, 2014 11:36
Cold Mountain #crumbs
<canvas id="canvas"></canvas>
@oampo
oampo / aliases.json
Last active August 29, 2015 14:02
Aliases #crumbs #no-index
{
"/work": "8ad52561445ec13c0d04",
"/about": "e63b610e2ce53f4d6aba",
"/local": "f7c18ce5e76151cbaf93"
}
@oampo
oampo / list.css
Last active August 29, 2015 14:02
Pages #crumbs #no-index
ul.list {
list-style-type: none;
padding: 0;
font-size: 2em;
text-align: center;
}