Skip to content

Instantly share code, notes, and snippets.

<?php
date_default_timezone_set('Europe/London'); // Set this to your local timezone - http://www.php.net/manual/en/timezones.php
/**
* The root directory where the repos live.
*
* @var string
*/
$root_dir = '/your/root/dir/';
@dmayo2
dmayo2 / sp-awesome-01
Last active March 20, 2018 14:55
Code for Making Dumb Components Smart: Refactoring
const Footer = (props) => {
return (
<div>Footer Info</div>
<div>&copy; 2004 - {props.year}</div>
)
};
@dmayo2
dmayo2 / sp-awesome-02
Last active March 20, 2018 14:57
Code for Making Dumb Components Smart: Refactoring
const Output = ({ loading, images, counter, }) => (
!loading ? (
<div>
<Table responsive>
<thead>
<tr>
<th />
<th>Image</th>
<th>File Name</th>
<th>Size</th>
@dmayo2
dmayo2 / sp-awesome-03
Last active March 20, 2018 14:58
Code for Making Dumb Components Smart: Refactoring
const Output = ({ loading, images, counter, }) => {}
@dmayo2
dmayo2 / sp-awesome-04
Last active March 20, 2018 14:58
Code for Making Dumb Components Smart: Refactoring
function Output(loading, images, counter) {}
@dmayo2
dmayo2 / sp-awesome-05
Created March 9, 2018 04:09
Code for Making Dumb Components Smart: Refactoring
imageObject1 = {
_id: 01,
fileName: 'MyImage.jpg',
size: 168,
src: 'http://example.com/images/',
}
imageObject2 = {
_id: 02,
fileName: 'AnotherImage.png',
@dmayo2
dmayo2 / sp-awesome-06
Last active March 12, 2018 17:48
Code for Making Dumb Components Smart: Refactoring
// database call which returns the `images` object which contains an array of objects
images: ImagesCollection.find().fetch()
@dmayo2
dmayo2 / sp-awesome-07
Created March 9, 2018 04:11
Code for Making Dumb Components Smart: Refactoring
images = [
{ _id: 01, fileName: 'MyImage.jpg', size: 168, src: 'http://example.com/images',}
{ _id: 02, filename: 'AnotherImage.png', size: 1450, src: 'http://imgfiles.net/',}
];
@dmayo2
dmayo2 / sp-awesome-08
Created March 9, 2018 04:12
Code for Making Dumb Components Smart: Refactoring
let imageName1 = images[0].fileName;
let imageName2 = images[1].fileName;
@dmayo2
dmayo2 / sp-awesome-09
Created March 9, 2018 04:13
Code for Making Dumb Components Smart: Refactoring
!loading ? (