Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging
Conflicts: seed/challenges/basic-javascript.json
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
This is the entry point for the client
|
||||
Code that should only run on the client should be put here.
|
||||
|
||||
NOTE(berks): For react specific stuff this should be the entry point
|
||||
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"restApiRoot": "/api",
|
||||
"remoting": {
|
||||
"context": {
|
||||
"enableHttpContext": false
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
var globalConfig = require('../common/config.global');
|
||||
|
||||
module.exports = {
|
||||
restApiRoot: globalConfig.restApi
|
||||
};
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"remote": {
|
||||
"name": "remote",
|
||||
"connector": "remote"
|
||||
},
|
||||
"local": {
|
||||
"name": "local",
|
||||
"connector": "memory"
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
var globalConfig = require('../common/config.global');
|
||||
|
||||
module.exports = {
|
||||
remote: {
|
||||
url: globalConfig.restApiUrl
|
||||
}
|
||||
};
|
@ -1,8 +1,9 @@
|
||||
import Rx from 'rx';
|
||||
import React from 'react';
|
||||
import Fetchr from 'fetchr';
|
||||
import debugFactory from 'debug';
|
||||
import { Router } from 'react-router';
|
||||
import { history } from 'react-router/lib/BrowserHistory';
|
||||
import debugFactory from 'debug';
|
||||
import { hydrate } from 'thundercats';
|
||||
import { Render } from 'thundercats-react';
|
||||
|
||||
@ -11,6 +12,9 @@ import { app$ } from '../common/app';
|
||||
const debug = debugFactory('fcc:client');
|
||||
const DOMContianer = document.getElementById('fcc');
|
||||
const catState = window.__fcc__.data || {};
|
||||
const services = new Fetchr({
|
||||
xhrPath: '/services'
|
||||
});
|
||||
|
||||
Rx.longStackSupport = !!debug.enabled;
|
||||
|
||||
@ -18,7 +22,7 @@ Rx.longStackSupport = !!debug.enabled;
|
||||
app$(history)
|
||||
.flatMap(
|
||||
({ AppCat }) => {
|
||||
const appCat = AppCat();
|
||||
const appCat = AppCat(null, services);
|
||||
return hydrate(appCat, catState)
|
||||
.map(() => appCat);
|
||||
},
|
||||
|
@ -1,8 +0,0 @@
|
||||
var loopback = require('loopback'),
|
||||
boot = require('loopback-boot');
|
||||
|
||||
var app = loopback();
|
||||
|
||||
boot(app, __dirname);
|
||||
|
||||
module.exports = app;
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"_meta": {
|
||||
"sources": [
|
||||
"../common/models",
|
||||
"./models"
|
||||
]
|
||||
},
|
||||
"user": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"bonfire": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"challenge": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"comment": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"fieldGuide": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"job": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"nonprofit": {
|
||||
"dataSource": "remote"
|
||||
},
|
||||
"story": {
|
||||
"dataSource": "remote"
|
||||
}
|
||||
}
|
@ -1,23 +1,37 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { contain } from 'thundercats-react';
|
||||
import { Row } from 'react-bootstrap';
|
||||
|
||||
import { Nav } from './components/Nav';
|
||||
import { Footer } from './components/Footer';
|
||||
|
||||
export default class extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
export default contain(
|
||||
{
|
||||
store: 'appStore',
|
||||
fetchAction: 'appActions.getUser',
|
||||
getPayload(props) {
|
||||
return {
|
||||
isPrimed: !!props.username
|
||||
};
|
||||
}
|
||||
},
|
||||
React.createClass({
|
||||
displayName: 'FreeCodeCamp',
|
||||
|
||||
static displayName = 'FreeCodeCamp'
|
||||
static propTypes = {
|
||||
children: PropTypes.node
|
||||
}
|
||||
propTypes: {
|
||||
children: PropTypes.node,
|
||||
username: PropTypes.string,
|
||||
points: PropTypes.number,
|
||||
picture: PropTypes.string
|
||||
},
|
||||
|
||||
render() {
|
||||
const { username, points, picture } = this.props;
|
||||
const navProps = { username, points, picture };
|
||||
return (
|
||||
<div>
|
||||
<Nav />
|
||||
<Nav
|
||||
{ ...navProps }/>
|
||||
<Row>
|
||||
{ this.props.children }
|
||||
</Row>
|
||||
@ -25,4 +39,5 @@ export default class extends React.Component {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -1,9 +1,17 @@
|
||||
import { Cat } from 'thundercats';
|
||||
import { HikesActions, HikesStore } from './routes/Hikes/flux';
|
||||
|
||||
import { AppActions, AppStore } from './flux';
|
||||
import { HikesActions, HikesStore } from './routes/Hikes/flux';
|
||||
import { JobActions, JobsStore} from './routes/Jobs/flux';
|
||||
|
||||
export default Cat()
|
||||
.init(({ instance }) => {
|
||||
instance.register(HikesActions);
|
||||
instance.register(HikesStore, null, instance);
|
||||
.init(({ instance: cat, args: [services] }) => {
|
||||
cat.register(AppActions, null, services);
|
||||
cat.register(AppStore, null, cat);
|
||||
|
||||
cat.register(HikesActions, null, services);
|
||||
cat.register(HikesStore, null, cat);
|
||||
|
||||
cat.register(JobActions, null, services);
|
||||
cat.register(JobsStore, null, cat);
|
||||
});
|
||||
|
@ -1,5 +1,11 @@
|
||||
import React from 'react';
|
||||
import { Nav, Navbar, NavItem } from 'react-bootstrap';
|
||||
import React, { PropTypes } from 'react';
|
||||
import {
|
||||
Col,
|
||||
CollapsibleNav,
|
||||
Nav,
|
||||
Navbar,
|
||||
NavItem
|
||||
} from 'react-bootstrap';
|
||||
|
||||
import navLinks from './links.json';
|
||||
import FCCNavItem from './NavItem.jsx';
|
||||
@ -25,6 +31,14 @@ const logoElement = (
|
||||
</a>
|
||||
);
|
||||
|
||||
const toggleButton = (
|
||||
<button className='hamburger'>
|
||||
<Col xs={ 12 }>
|
||||
<span className='hamburger-text'>Menu</span>
|
||||
</Col>
|
||||
</button>
|
||||
);
|
||||
|
||||
export default class extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -32,20 +46,37 @@ export default class extends React.Component {
|
||||
|
||||
static displayName = 'Nav'
|
||||
static propTypes = {
|
||||
signedIn: React.PropTypes.bool
|
||||
points: PropTypes.number,
|
||||
picture: PropTypes.string,
|
||||
signedIn: PropTypes.bool,
|
||||
username: PropTypes.string
|
||||
}
|
||||
|
||||
renderBrand() {
|
||||
renderPoints(username, points) {
|
||||
if (!username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
renderSignin() {
|
||||
if (this.props.signedIn) {
|
||||
return (
|
||||
<NavItem
|
||||
eventKey={ 2 }>
|
||||
Show Picture
|
||||
href={ '/' + username }>
|
||||
[ { points } ]
|
||||
</NavItem>
|
||||
);
|
||||
}
|
||||
|
||||
renderSignin(username, picture) {
|
||||
if (username) {
|
||||
return (
|
||||
<div
|
||||
className='hidden-xs hidden-sm'
|
||||
eventKey={ 2 }>
|
||||
<a href={ '/' + username }>
|
||||
<img
|
||||
className='profile-picture float-right'
|
||||
src={ picture } />
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<FCCNavItem
|
||||
@ -59,19 +90,24 @@ export default class extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { username, points, picture } = this.props;
|
||||
return (
|
||||
<Navbar
|
||||
brand={ logoElement }
|
||||
className='nav-height'
|
||||
fixedTop={ true }
|
||||
toggleButton={ toggleButton }
|
||||
toggleNavKey={ 0 }>
|
||||
<CollapsibleNav eventKey={ 0 }>
|
||||
<Nav
|
||||
className='hamburger-dropdown'
|
||||
eventKey={ 0 }
|
||||
navbar={ true }
|
||||
right={ true }>
|
||||
{ navElements }
|
||||
{ this.renderSignin() }
|
||||
{ this.renderPoints(username, points)}
|
||||
{ this.renderSignin(username, picture) }
|
||||
</Nav>
|
||||
</CollapsibleNav>
|
||||
</Navbar>
|
||||
);
|
||||
}
|
||||
|
31
common/app/flux/Actions.js
Normal file
31
common/app/flux/Actions.js
Normal file
@ -0,0 +1,31 @@
|
||||
import { Actions } from 'thundercats';
|
||||
import debugFactory from 'debug';
|
||||
|
||||
const debug = debugFactory('freecc:app:actions');
|
||||
|
||||
export default Actions({
|
||||
setUser({ username, picture, progressTimestamps = [] }) {
|
||||
return {
|
||||
username,
|
||||
picture,
|
||||
points: progressTimestamps.length
|
||||
};
|
||||
},
|
||||
getUser: null
|
||||
})
|
||||
.refs({ displayName: 'AppActions' })
|
||||
.init(({ instance: appActions, args: [services] }) => {
|
||||
appActions.getUser.subscribe(({ isPrimed }) => {
|
||||
if (isPrimed) {
|
||||
debug('isPrimed');
|
||||
return;
|
||||
}
|
||||
services.read('user', null, null, (err, user) => {
|
||||
if (err) {
|
||||
return debug('user service error');
|
||||
}
|
||||
debug('user service returned successful');
|
||||
return appActions.setUser(user);
|
||||
});
|
||||
});
|
||||
});
|
18
common/app/flux/Store.js
Normal file
18
common/app/flux/Store.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { Store } from 'thundercats';
|
||||
|
||||
const { createRegistrar, setter } = Store;
|
||||
const initValue = {
|
||||
username: null,
|
||||
picture: null,
|
||||
points: 0
|
||||
};
|
||||
|
||||
export default Store(initValue)
|
||||
.refs({ displayName: 'AppStore' })
|
||||
.init(({ instance: appStore, args: [cat] }) => {
|
||||
const { setUser } = cat.getActions('appActions');
|
||||
const register = createRegistrar(appStore);
|
||||
register(setter(setUser));
|
||||
|
||||
return appStore;
|
||||
});
|
2
common/app/flux/index.js
Normal file
2
common/app/flux/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
export AppActions from './Actions';
|
||||
export AppStore from './Store';
|
@ -1,12 +1,8 @@
|
||||
import { Actions } from 'thundercats';
|
||||
import assign from 'object.assign';
|
||||
import debugFactory from 'debug';
|
||||
import Fetchr from 'fetchr';
|
||||
|
||||
const debug = debugFactory('freecc:hikes:actions');
|
||||
const service = new Fetchr({
|
||||
xhrPath: '/services'
|
||||
});
|
||||
|
||||
function getCurrentHike(hikes =[{}], dashedName, currentHike) {
|
||||
if (!dashedName) {
|
||||
@ -36,12 +32,12 @@ export default Actions({
|
||||
setHikes: null
|
||||
})
|
||||
.refs({ displayName: 'HikesActions' })
|
||||
.init(({ instance }) => {
|
||||
.init(({ instance: hikeActions, args: [services] }) => {
|
||||
// set up hikes fetching
|
||||
instance.fetchHikes.subscribe(
|
||||
hikeActions.fetchHikes.subscribe(
|
||||
({ isPrimed, dashedName }) => {
|
||||
if (isPrimed) {
|
||||
return instance.setHikes({
|
||||
return hikeActions.setHikes({
|
||||
transform: (oldState) => {
|
||||
const { hikes } = oldState;
|
||||
const currentHike = getCurrentHike(
|
||||
@ -53,11 +49,11 @@ export default Actions({
|
||||
}
|
||||
});
|
||||
}
|
||||
service.read('hikes', null, null, (err, hikes) => {
|
||||
services.read('hikes', null, null, (err, hikes) => {
|
||||
if (err) {
|
||||
debug('an error occurred fetching hikes', err);
|
||||
}
|
||||
instance.setHikes({
|
||||
hikeActions.setHikes({
|
||||
set: {
|
||||
hikes: hikes,
|
||||
currentHike: getCurrentHike(hikes, dashedName)
|
||||
|
@ -7,11 +7,10 @@ const initialValue = {
|
||||
|
||||
export default Store(initialValue)
|
||||
.refs({ displayName: 'HikesStore'})
|
||||
.init(({ instance, args }) => {
|
||||
const [cat] = args;
|
||||
.init(({ instance: hikeStore, args: [cat] }) => {
|
||||
|
||||
let { setHikes } = cat.getActions('hikesActions');
|
||||
instance.register(setHikes);
|
||||
hikeStore.register(setHikes);
|
||||
|
||||
return instance;
|
||||
return hikeStore;
|
||||
});
|
||||
|
@ -1,15 +0,0 @@
|
||||
import { Actions } from 'thundercats';
|
||||
|
||||
export default class JobsActions extends Actions {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
static displayName = 'JobsActions'
|
||||
|
||||
getJob(id) {
|
||||
return { id };
|
||||
}
|
||||
getJobs(params) {
|
||||
return { params };
|
||||
}
|
||||
}
|
@ -1,28 +1,62 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { createContainer } from 'thundercats';
|
||||
import { Grid, Row } from 'react-bootstrap';
|
||||
import React, { cloneElement, PropTypes } from 'react';
|
||||
import { contain } from 'thundercats-react';
|
||||
import { Button, Jumbotron, Row } from 'react-bootstrap';
|
||||
import ShowJobs from './Show.jsx';
|
||||
|
||||
@createContainer({
|
||||
store: 'JobsStore'
|
||||
})
|
||||
export default class extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
|
||||
static displayName = 'Jobs'
|
||||
static propTypes = {
|
||||
export default contain(
|
||||
{
|
||||
store: 'jobsStore',
|
||||
fetchAction: 'jobActions.getJobs'
|
||||
},
|
||||
React.createClass({
|
||||
displayName: 'Jobs',
|
||||
propTypes: {
|
||||
children: PropTypes.element,
|
||||
jobs: PropTypes.array
|
||||
},
|
||||
|
||||
renderShow(jobs) {
|
||||
return (
|
||||
<ShowJobs jobs={ jobs }/>
|
||||
);
|
||||
},
|
||||
|
||||
renderChild(child, jobs) {
|
||||
if (!child) {
|
||||
return null;
|
||||
}
|
||||
return cloneElement(
|
||||
child,
|
||||
{ jobs }
|
||||
);
|
||||
},
|
||||
|
||||
render() {
|
||||
const { children, jobs } = this.props;
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
<div>
|
||||
<Row>
|
||||
foo
|
||||
<Jumbotron>
|
||||
<h1>Free Code Camps' Job Board</h1>
|
||||
<p>
|
||||
Need to find the best junior developers?
|
||||
Want to find dedicated developers eager to join your company?
|
||||
Sign up now to post your job!
|
||||
</p>
|
||||
<Button
|
||||
bsSize='large'
|
||||
className='signup-btn'>
|
||||
Try the first month 20% off!
|
||||
</Button>
|
||||
</Jumbotron>
|
||||
</Row>
|
||||
</Grid>
|
||||
<Row>
|
||||
{ this.renderChild(children, jobs) ||
|
||||
this.renderShow(jobs) }
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -1,13 +0,0 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
|
||||
export default class extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
static displayName = 'JobsList'
|
||||
static propTypes = {}
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
}
|
79
common/app/routes/Jobs/components/Show.jsx
Normal file
79
common/app/routes/Jobs/components/Show.jsx
Normal file
@ -0,0 +1,79 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { contain } from 'thundercats-react';
|
||||
import { Accordion, Thumbnail, Panel, Well } from 'react-bootstrap';
|
||||
import moment from 'moment';
|
||||
|
||||
export default contain(
|
||||
{
|
||||
},
|
||||
React.createClass({
|
||||
displayName: 'ShowJobs',
|
||||
|
||||
propTypes: {
|
||||
jobs: PropTypes.array
|
||||
},
|
||||
|
||||
renderJobs(jobs =[]) {
|
||||
const thumbnailStyle = {
|
||||
backgroundColor: 'white',
|
||||
maxHeight: '200px',
|
||||
maxWidth: '200px'
|
||||
};
|
||||
return jobs.map((
|
||||
{
|
||||
id,
|
||||
company,
|
||||
position,
|
||||
description,
|
||||
logo,
|
||||
city,
|
||||
state,
|
||||
email,
|
||||
phone,
|
||||
postedOn
|
||||
},
|
||||
index
|
||||
) => {
|
||||
const header = (
|
||||
<div>
|
||||
<h4 style={{ display: 'inline-block' }}>{ company }</h4>
|
||||
<h5
|
||||
className='pull-right hidden-xs hidden-md'
|
||||
style={{ display: 'inline-block' }}>
|
||||
{ position }
|
||||
</h5>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<Panel
|
||||
collapsable={ true }
|
||||
eventKey={ index }
|
||||
header={ header }
|
||||
key={ id }>
|
||||
<Thumbnail
|
||||
alt='200x200' src={ logo }
|
||||
style={ thumbnailStyle } />
|
||||
<Well>
|
||||
Position: { position }
|
||||
Location: { city }, { state }
|
||||
<br />
|
||||
Contact: { email || phone || 'N/A' }
|
||||
<br />
|
||||
Posted On: { moment(postedOn).format('MMMM Do, YYYY') }
|
||||
</Well>
|
||||
<p>{ description }</p>
|
||||
</Panel>
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
const { jobs } = this.props;
|
||||
return (
|
||||
<Accordion>
|
||||
{ this.renderJobs(jobs) }
|
||||
</Accordion>
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
@ -1,9 +0,0 @@
|
||||
import { Store } from 'thundercats';
|
||||
|
||||
export default class JobsStore extends Store {
|
||||
constructor(cat) {
|
||||
super();
|
||||
let JobsActions = cat.getActions('JobsActions');
|
||||
}
|
||||
static displayName = 'JobsStore'
|
||||
}
|
27
common/app/routes/Jobs/flux/Actions.js
Normal file
27
common/app/routes/Jobs/flux/Actions.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { Actions } from 'thundercats';
|
||||
import debugFactory from 'debug';
|
||||
|
||||
const debug = debugFactory('freecc:jobs:actions');
|
||||
|
||||
export default Actions({
|
||||
setJobs: null,
|
||||
getJob(id) {
|
||||
return { id };
|
||||
},
|
||||
getJobs(params) {
|
||||
return { params };
|
||||
}
|
||||
})
|
||||
.refs({ displayName: 'JobActions' })
|
||||
.init(({ instance: jobActions, args: [services] }) => {
|
||||
jobActions.getJobs.subscribe(() => {
|
||||
services.read('job', null, null, (err, jobs) => {
|
||||
if (err) {
|
||||
debug('job services experienced an issue', err);
|
||||
jobActions.setJobs({ jobs: [] });
|
||||
}
|
||||
jobActions.setJobs({ jobs });
|
||||
});
|
||||
});
|
||||
return jobActions;
|
||||
});
|
10
common/app/routes/Jobs/flux/Store.js
Normal file
10
common/app/routes/Jobs/flux/Store.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { Store } from 'thundercats';
|
||||
|
||||
const { setter } = Store;
|
||||
|
||||
export default Store()
|
||||
.refs({ displayName: 'JobsStore' })
|
||||
.init(({ instance: jobsStore, args: [cat] }) => {
|
||||
let jobActions = cat.getActions('JobActions');
|
||||
jobsStore.register(setter(jobActions.setJobs));
|
||||
});
|
2
common/app/routes/Jobs/flux/index.js
Normal file
2
common/app/routes/Jobs/flux/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
export { default as JobActions } from './Actions';
|
||||
export { default as JobsStore } from './Store';
|
@ -9,10 +9,6 @@ import Jobs from './components/Jobs.jsx';
|
||||
*/
|
||||
|
||||
export default {
|
||||
path: '/jobs/(:jobId)',
|
||||
getComponents(cb) {
|
||||
setTimeout(() => {
|
||||
cb(null, Jobs);
|
||||
}, 0);
|
||||
}
|
||||
path: 'jobs',
|
||||
component: Jobs
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
// import Jobs from './Jobs';
|
||||
import Jobs from './Jobs';
|
||||
import Hikes from './Hikes';
|
||||
|
||||
export default {
|
||||
@ -6,7 +6,7 @@ export default {
|
||||
getChildRoutes(locationState, cb) {
|
||||
setTimeout(() => {
|
||||
cb(null, [
|
||||
// Jobs,
|
||||
Jobs,
|
||||
Hikes
|
||||
]);
|
||||
}, 0);
|
||||
|
@ -10,14 +10,42 @@
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"logoUrl": {
|
||||
"logo": {
|
||||
"type": "string"
|
||||
},
|
||||
"postingUrl": {
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"copy": {
|
||||
"type": "array"
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"location": {
|
||||
"type": "geopoint"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"isApproverd": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isHighlighted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPaid": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"postedOn": {
|
||||
"type": "date",
|
||||
"defaultFn": "now"
|
||||
}
|
||||
},
|
||||
"validations": [],
|
||||
|
83
gulpfile.js
83
gulpfile.js
@ -4,16 +4,11 @@ var Rx = require('rx'),
|
||||
path = require('path'),
|
||||
|
||||
// utils
|
||||
plumber = require('gulp-plumber'),
|
||||
notify = require('gulp-notify'),
|
||||
debug = require('debug')('freecc:gulp'),
|
||||
bower = require('bower-main-files'),
|
||||
|
||||
// loopback client
|
||||
browserify = require('browserify'),
|
||||
boot = require('loopback-boot'),
|
||||
envify = require('envify/custom'),
|
||||
toVinylWithName = require('vinyl-source-stream'),
|
||||
|
||||
// react app
|
||||
webpack = require('gulp-webpack'),
|
||||
webpackConfig = require('./webpack.config.js'),
|
||||
@ -67,57 +62,58 @@ var paths = {
|
||||
]
|
||||
};
|
||||
|
||||
var webpackOptions = {
|
||||
devtool: 'inline-source-map'
|
||||
};
|
||||
|
||||
function errorHandler() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
// Send error to notification center with gulp-notify
|
||||
notify.onError({
|
||||
title: 'Compile Error',
|
||||
message: '<%= error %>'
|
||||
}).apply(this, args);
|
||||
|
||||
// Keep gulp from hanging on this task
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
gulp.task('inject', function() {
|
||||
gulp.src('views/home.jade')
|
||||
.pipe(plumber({ errorHandler: errorHandler }))
|
||||
.pipe(inject(gulp.src(bower()), {
|
||||
//ignorePath: '/public'
|
||||
}))
|
||||
.pipe(gulp.dest('views'));
|
||||
});
|
||||
|
||||
// NOTE(berks): not using this for now as loopback client is just too large
|
||||
gulp.task('loopback', function() {
|
||||
var config = {
|
||||
basedir: __dirname,
|
||||
debug: true,
|
||||
cache: {},
|
||||
packageCache: {},
|
||||
fullPaths: true,
|
||||
standalone: paths.loopback.clientName
|
||||
};
|
||||
|
||||
var b = browserify(config);
|
||||
|
||||
// compile loopback for the client
|
||||
b.require(paths.loopback.client);
|
||||
|
||||
boot.compileToBrowserify(paths.loopback.root, b);
|
||||
|
||||
// sub process.env for proper strings
|
||||
b.transform(envify({
|
||||
NODE_ENV: 'development'
|
||||
}));
|
||||
|
||||
return b.bundle()
|
||||
.on('error', errorNotifier)
|
||||
.pipe(toVinylWithName(paths.loopback.clientName + '.js'))
|
||||
.pipe(gulp.dest(paths.publicJs));
|
||||
});
|
||||
|
||||
gulp.task('pack-client', function() {
|
||||
return gulp.src(webpackConfig.entry)
|
||||
.pipe(webpack(webpackConfig))
|
||||
.pipe(plumber({ errorHandler: errorHandler }))
|
||||
.pipe(webpack(Object.assign(
|
||||
{},
|
||||
webpackConfig,
|
||||
webpackOptions
|
||||
)))
|
||||
.pipe(gulp.dest(webpackConfig.output.path));
|
||||
});
|
||||
|
||||
gulp.task('pack-watch', function() {
|
||||
return gulp.src(webpackConfig.entry)
|
||||
.pipe(webpack(Object.assign(webpackConfig, { watch: true })))
|
||||
.pipe(plumber({ errorHandler: errorHandler }))
|
||||
.pipe(webpack(Object.assign(
|
||||
{},
|
||||
webpackConfig,
|
||||
webpackOptions,
|
||||
{ watch: true }
|
||||
)))
|
||||
.pipe(gulp.dest(webpackConfig.output.path));
|
||||
});
|
||||
|
||||
gulp.task('pack-node', function() {
|
||||
return gulp.src(webpackConfigNode.entry)
|
||||
.pipe(plumber({ errorHandler: errorHandler }))
|
||||
.pipe(webpack(webpackConfigNode))
|
||||
.pipe(gulp.dest(webpackConfigNode.output.path));
|
||||
});
|
||||
@ -174,6 +170,7 @@ gulp.task('lint', function() {
|
||||
|
||||
gulp.task('less', function() {
|
||||
return gulp.src('./public/css/*.less')
|
||||
.pipe(plumber({ errorHandler: errorHandler }))
|
||||
.pipe(less({
|
||||
paths: [ path.join(__dirname, 'less', 'includes') ]
|
||||
}))
|
||||
@ -188,15 +185,3 @@ gulp.task('watch', ['less', 'serve', 'sync'], function() {
|
||||
|
||||
gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']);
|
||||
|
||||
function errorNotifier() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
// Send error to notification center with gulp-notify
|
||||
notify.onError({
|
||||
title: 'Compile Error',
|
||||
message: '<%= error %>'
|
||||
}).apply(this, args);
|
||||
|
||||
// Keep gulp from hanging on this task
|
||||
this.emit('end');
|
||||
}
|
||||
|
11
package.json
11
package.json
@ -5,15 +5,13 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/freecodecamp/freecodecamp.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.35",
|
||||
"npm": "2.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build-production": "webpack",
|
||||
"start": "babel-node server/server.js",
|
||||
"prestart-production": "bower cache clean && bower install && gulp build && npm run build-production",
|
||||
"start-production": "node pm2Start",
|
||||
"lint": "eslint --ext=.js,.jsx .",
|
||||
"test": "mocha",
|
||||
"postinstall": "bower cache clean && bower install && gulp build"
|
||||
"test": "mocha"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"contributors": [
|
||||
@ -120,6 +118,7 @@
|
||||
"gulp-inject": "~1.0.2",
|
||||
"gulp-nodemon": "^2.0.3",
|
||||
"gulp-notify": "^2.2.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"istanbul": "^0.3.15",
|
||||
"loopback-explorer": "^1.7.2",
|
||||
"loopback-testing": "^1.1.0",
|
||||
|
@ -1,9 +1,8 @@
|
||||
require('babel/register');
|
||||
var pm2 = require('pm2');
|
||||
pm2.connect(function() {
|
||||
pm2.start({
|
||||
name: 'server',
|
||||
script: 'server/server.js',
|
||||
script: 'server/production-start.js',
|
||||
'exec_mode': 'cluster',
|
||||
instances: '2',
|
||||
'max_memory_restart': '900M'
|
||||
|
@ -334,6 +334,7 @@ ul {
|
||||
.navbar {
|
||||
white-space: nowrap;
|
||||
border: none;
|
||||
line-height: 1;
|
||||
@media (min-width: 767px) {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Basic JavaScript",
|
||||
"order": 0.005,
|
||||
"order": 0.006,
|
||||
"challenges": [
|
||||
{
|
||||
"id":"bd7123c9c441eddfaeb4bdef",
|
||||
@ -265,7 +265,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb3bdef",
|
||||
"id": "cf1111c1c11feddfaeb3bdef",
|
||||
"name": "Magical Maths Addition",
|
||||
"dashedName": "waypoint-magical-maths-addition",
|
||||
"difficulty": "9.98141",
|
||||
@ -289,7 +289,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb4bdef",
|
||||
"id": "cf1111c1c11feddfaeb4bdef",
|
||||
"name": "Magical Maths Subtraction",
|
||||
"dashedName": "waypoint-magical-maths-subtraction",
|
||||
"difficulty": "9.98142",
|
||||
@ -313,7 +313,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb5bdef",
|
||||
"id": "cf1231c1c11feddfaeb5bdef",
|
||||
"name": "Magical Maths Multiplication",
|
||||
"dashedName": "waypoint-magical-maths-multiplication",
|
||||
"difficulty": "9.98143",
|
||||
@ -337,7 +337,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb6bdef",
|
||||
"id": "cf1111c1c11feddfaeb6bdef",
|
||||
"name": "Magical Maths Division",
|
||||
"dashedName": "waypoint-magical-maths-division",
|
||||
"difficulty": "9.9814",
|
||||
@ -361,7 +361,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb4bdee",
|
||||
"id": "cf1391c1c11feddfaeb4bdef",
|
||||
"name": "Creating Decimals",
|
||||
"dashedName": "waypoint-creating-decimals",
|
||||
"difficulty": "9.9815",
|
||||
@ -439,7 +439,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb7bdef",
|
||||
"id":"cf1111c1c11feddfaeb7bdef",
|
||||
"name":"Nesting Arrays",
|
||||
"dashedName":"waypoint-nesting-arrays",
|
||||
"difficulty":"9.98161",
|
||||
@ -470,8 +470,9 @@
|
||||
"Indexes are written in the same way as bracket notation that we covered earlier",
|
||||
"Example:",
|
||||
"<code>",
|
||||
"var array = [1,2,3]",
|
||||
"array[0]//equals 1",
|
||||
"var array = [1,2,3];",
|
||||
"array[0];//equals 1",
|
||||
"var data = array[1];",
|
||||
"</code>",
|
||||
"Create a var called <code>data</code> and set it to equal the first value of <code>myArray</code>"
|
||||
],
|
||||
@ -490,6 +491,39 @@
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c11feddfaeb8bdef",
|
||||
"name":"Modifying Data With Indexes",
|
||||
"dashedName":"waypoint-modifying-data-with-indexes",
|
||||
"difficulty":"9.98171",
|
||||
"description":[
|
||||
"",
|
||||
"We are able to modify the data store in an array be using indexes",
|
||||
"Example:",
|
||||
"<code>",
|
||||
"var ourArray = [1,2,3];",
|
||||
"ourArray[0] = 3;//ourArray equals [3,2,3]",
|
||||
"</code>",
|
||||
"Now Let's modify <code>myArray</code> using an index",
|
||||
""
|
||||
],
|
||||
"tests":[
|
||||
"assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return(true);}else{return(false);}})(), 'myArray should now be [3,2,3]');",
|
||||
"assert((function(){if(editor.getValue().match(/[0]/g).length >= 2 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values in myArray');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//var ourArray = [1,2,3];",
|
||||
"//ourArray[0] = 3;",
|
||||
"",
|
||||
"var myArray = [1,2,3];",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"if(typeof(myArray) != 'undefined'){(function(){return(myArray);})();}"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bg9994c9c69feddfaeb9bdef",
|
||||
"name": "Manipulating Arrays With pop()",
|
||||
@ -602,123 +636,31 @@
|
||||
"In JavaScript we can divide up our code into separate and reusable parts called functions",
|
||||
"here's and example of a function",
|
||||
"<code>",
|
||||
"function funcitonName (one, two ,three){",
|
||||
" /*Some Code*/",
|
||||
"function functionName (a, b){",
|
||||
" return(a + b);",
|
||||
"}",
|
||||
"</code>",
|
||||
"our function can be called like this",
|
||||
"<code>functionName();</code>",
|
||||
"Let's try creating and calling a function now."
|
||||
"Let's try creating and calling a function now called <code>myFunction</code>"
|
||||
],
|
||||
"tests":[
|
||||
"assert(f==data);"
|
||||
"assert((function(){if(typeof(f) !== 'undefined' && typeof(f) === 'number' && f === 9){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//var ourData = 'function called!';",
|
||||
"//function ourFunction(ourData) {/*ourData is being passed to this function as an argument*/",
|
||||
"//return(data);",
|
||||
"//}",
|
||||
"",
|
||||
"var data = 'Function Called!';",
|
||||
"",
|
||||
"//Create a function called myFunction that takes data as an argument and returns it like the example above",
|
||||
"",
|
||||
"var a = 4;",
|
||||
"var b = 5;",
|
||||
"//Don not modify the above!",
|
||||
"//Create a function called myFunction that adds a and b",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"//Don't modify this!",
|
||||
"var f=myFunction(data);",
|
||||
"(function(){var f=myFunction(data);return(f);})('');"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bg9997c9c99feddfaeb9bdef",
|
||||
"name": "Doing things inside functions",
|
||||
"dashedName": "waypoint-doing-things-inside-functions",
|
||||
"difficulty": "9.982",
|
||||
"description": [
|
||||
"",
|
||||
"A function that takes the value you give it and returns it isn't very useful! So now let's get our functions to do something!",
|
||||
"Starting from where we were last time let's make our function revers whatever we give it by chaining <code> .split('') </code>, <code> .reverse() </code> and <code> .join('') </code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(f==data.split('').reverse().join(''), 'myFunction should now return the reversed version of data (!dellaC noitcnuF)');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"//You can reverse strings like this",
|
||||
"//var notReversed = 'String';",
|
||||
"//var reversed = notReversed.split('').reverse().join('');",
|
||||
"",
|
||||
"var data = 'Function Called!';",
|
||||
"",
|
||||
"function myFunction(data){",
|
||||
" ",
|
||||
" return(data);",
|
||||
"}",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"//Don't modify this!",
|
||||
"var f=myFunction(data);",
|
||||
"(function(f){return(f);})(f);"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bg9997c9c99feddfaeb9bdee",
|
||||
"name": "Keeping In The Scope Of Things",
|
||||
"dashedName": "waypoint-keeping-in-the-scope-of-things",
|
||||
"difficulty": "9.9821",
|
||||
"description": [
|
||||
"",
|
||||
"All variables are contained in something called a <code> scope </code>.",
|
||||
"A Scope defines where are variable can be accessed.",
|
||||
"All variables created outside any functions exist in what is called the <code> global scope </code>",
|
||||
"All variables are container or are scope to inside that function.",
|
||||
"<code>",
|
||||
"var variable = 'Global Scope'",
|
||||
"function test(){",
|
||||
" return(variable);",
|
||||
"}",
|
||||
"test();//Returns Global Scope",
|
||||
"",
|
||||
"function change(){",
|
||||
" variable = 'test';",
|
||||
" return(variable);",
|
||||
"}",
|
||||
"",
|
||||
"change();//Returns test",
|
||||
"variable //equals Global Scope",
|
||||
"",
|
||||
"</code>",
|
||||
"Let's give this a go!"
|
||||
],
|
||||
"tests": [
|
||||
"assert(Global == access(Global), 'access should return your Global var');",
|
||||
"assert(Global != localChange(Global), 'localChange should return your Global var');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"//Create Your global variable with any value here",
|
||||
"var Global = _;",
|
||||
"",
|
||||
"//Make access() return you global variable",
|
||||
"function access(){",
|
||||
" ",
|
||||
"}",
|
||||
"",
|
||||
"access();",
|
||||
"",
|
||||
"//Pass you global variable into localChange and modify it within the function",
|
||||
"function localChange(){",
|
||||
" ",
|
||||
"}",
|
||||
"",
|
||||
"//Don't forget to call localChange here and pass your global variable",
|
||||
"",
|
||||
"",
|
||||
"(function(x,y,z){return('access returns: ' + y(x) + ' & localChange returns: ' + z(x));})(Global, access, localChange);"
|
||||
"if(typeof(myFunction) != 'undefined'){",
|
||||
"var f=myFunction(a,b);",
|
||||
"(function(){return(f);})();",
|
||||
"}"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
@ -816,7 +758,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb5bdee",
|
||||
"id":"cf1111c1c11feddfaeb5bdef",
|
||||
"name":"Looping with for",
|
||||
"dashedName":"waypoint-looping-with-for",
|
||||
"difficulty":"9.9824",
|
||||
@ -846,7 +788,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb1bdef",
|
||||
"id":"cf1111c1c11feddfaeb1bdef",
|
||||
"name":"Looping with while",
|
||||
"dashedName":"waypoint-looping-with-while",
|
||||
"difficulty":"9.9825",
|
||||
@ -877,7 +819,7 @@
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id": "bd1111c1c11feddfaeb2bdef",
|
||||
"id":"cf1111c1c11feddfaeb2bdef",
|
||||
"name":"Looping with do while",
|
||||
"dashedName":"waypoint-looping-with-do-while",
|
||||
"difficulty":"9.9826",
|
||||
@ -906,6 +848,227 @@
|
||||
""
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c11feddfaeb9bdef",
|
||||
"name":"Random Numbers",
|
||||
"dashedName":"waypoint-random-numbers",
|
||||
"difficulty":"9.9827",
|
||||
"description":[
|
||||
"",
|
||||
"Random numbers are a very useful for creating random behaviours and games",
|
||||
"Javascript has a <code>Math.random()</code> method that can generate a random decimal number",
|
||||
"Let's have a go of <code>Math.random()</code> now be getting <code>myFunction</code> to return a random number"
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(myFunction()) === 'number', 'myFunction should return a random number');",
|
||||
"assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');",
|
||||
"assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"",
|
||||
"function myFunction(){",
|
||||
" //Change the 0 to Math.random()",
|
||||
" return(0);",
|
||||
"}",
|
||||
"",
|
||||
"(function(){return(myFunction());})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb1bdef",
|
||||
"name":"Random Whole Numbers",
|
||||
"dashedName":"waypoint-random-whole-numbers",
|
||||
"difficulty":"9.9828",
|
||||
"description":[
|
||||
"",
|
||||
"While it's great that we can create random decimal numbers it's a lot more useful to generate a random whole number",
|
||||
"To achieve this we can multiply the random number by ten and use the <code>Math.floor()</code> to convert the decimal number to a whole number",
|
||||
"This technique gives us a whole number between zero and nine",
|
||||
"Example:",
|
||||
"<code>Math.floor(Math.random()*10);</code>",
|
||||
"Let's give this technique a go now"
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(myFunction()) == 'number', 'The result of myFunction should be a number');",
|
||||
"assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number');",
|
||||
"assert(!(''+myFunction()).match(/\\./g), 'You should have multiplied the result of Math.random but 10 to make it a number that\\'s greater then zero');",
|
||||
"assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"function myFunction(){",
|
||||
" //Make myFunction return a random number between zero and nine instead of a float",
|
||||
" return(Math.random());",
|
||||
"}",
|
||||
"",
|
||||
"(function(){return(myFunction());})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb2bdef",
|
||||
"name":"Random Whole Numbers In a Range",
|
||||
"dashedName":"waypoint-random-whole-numbers-in-a-range",
|
||||
"difficulty":"9.9829",
|
||||
"description":[
|
||||
"",
|
||||
"We can use a certain mathematical expression to get a random number between between twp numbers.",
|
||||
"<code>Math.floor(Math.random() * (max - min + 1)) + min</code>",
|
||||
"By using this we can control the output of the random number.",
|
||||
""
|
||||
],
|
||||
"tests":[
|
||||
"assert(myFunction() >= min, 'The random number that\\'s generated by myFunction should be greater than or equal to the minimum number');",
|
||||
"assert(myFunction() <= max, 'The random number that\\'s generated by myFunction should be less than or equal to the maximum number');",
|
||||
"assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 3 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return(true);}else{return(false);}})(), 'You should be using the function given in the description to calculate the random in number in a range');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
" var min = 0;",
|
||||
" var max = 12;",
|
||||
"function myFunction(){",
|
||||
" //Make myFunction return a random number between zero and nine instead of a float",
|
||||
" return(Math.random());",
|
||||
"}",
|
||||
"",
|
||||
"(function(){return(myFunction());})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb3bdef",
|
||||
"name":"If Else Statements",
|
||||
"dashedName":"waypoint-if-else-statements",
|
||||
"difficulty":"9.983",
|
||||
"description":[
|
||||
"",
|
||||
"We can use if statements in JavaScript to only execute code if a certain condition is met",
|
||||
"if statements require some sort of boolean condition evaluate",
|
||||
"Example:",
|
||||
"<code>if(1==2){",
|
||||
" return(true);",
|
||||
"}",
|
||||
"else{",
|
||||
" return(false);",
|
||||
"}</code>",
|
||||
"Let's have a go of using if statements now by making a coin-flip game",
|
||||
"Create an if else statement to return <code>heads</code> if the flip var is zero and to return <code>tails</code> if it's not"
|
||||
],
|
||||
"tests":[
|
||||
"assert((function(){if(myFunction() == 'heads' || myFunction() == 'tails'){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');",
|
||||
"assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');",
|
||||
"assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"function myFunction(){",
|
||||
" var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;",
|
||||
" //Create and if else statement here to return heads if flip is 0 otherwise return false",
|
||||
" ",
|
||||
"}",
|
||||
"",
|
||||
"(function(){return(myFunction());})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb6bdef",
|
||||
"name":"An Intro To RegEx",
|
||||
"dashedName":"waypoint-an-intro-to-regex",
|
||||
"difficulty":"9.984",
|
||||
"description":[
|
||||
"",
|
||||
"RegEx is a powerful tool we can use to find certain words or patterns in strings",
|
||||
"RegEx can look difficult at first but there's not much to getting it working",
|
||||
"If we wanted to find the number of times the word \"the\" occured in the string \"The dog chased the cat\" We could use the following RegEx:",
|
||||
"<code>\/the+\/gi</code>",
|
||||
"Let's break this down a bit",
|
||||
"\"The\" is the pattern we want to match",
|
||||
"\"+\" means we are looking for one or more occurrences of this pattern",
|
||||
"\"g\" means that it searhces the whole string",
|
||||
"\"i\" means that we are ignoring the case(upper or lower) of what we are looking for",
|
||||
"Let's try finding the word and in the string \"John and Alan went to the shop and got some milk\" by replacing the <code>.+</code> in the currnet RegEx with something that will find the word \"and\" and count how many times it occurs"
|
||||
],
|
||||
"tests":[
|
||||
"assert(test==2, 'You\\'re RegEx should have found two occurances of the word \"and\"');",
|
||||
"assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used this RegEx to find the word \"and\"');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var test = (function(){",
|
||||
" var testString = \"John and Alan went to the shop and got some milk\";",
|
||||
"",
|
||||
"//Do Not Modify Above",
|
||||
"",
|
||||
" var expression = /.+/gi;",
|
||||
"",
|
||||
"//Do Not Modify Below",
|
||||
"",
|
||||
" return(testString.match(expression).length);",
|
||||
"})();(function(){return(test);})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb7bdef",
|
||||
"name":"Finding Numbers",
|
||||
"dashedName":"waypoint-finding-numbers",
|
||||
"difficulty":"9.985",
|
||||
"description":[
|
||||
"",
|
||||
"We can use special selectors in RegEx to select a particular type of value",
|
||||
"One such selector is the digit selector <code>\\d</code> which is used to grab the numbers in a string",
|
||||
"It is used like this:",
|
||||
"<code>/\\d+/g</code>",
|
||||
""
|
||||
],
|
||||
"tests":[
|
||||
"assert(test === 2, 'Your RegEx should have found two numbers in the testString');",
|
||||
"assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\d+/gi to find the numbers in the testString');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var test = (function(){",
|
||||
" var testString = \"There's 3 cats but 4 dogs.\"",
|
||||
"",
|
||||
"//Do Not Modify Above",
|
||||
"",
|
||||
" var expression = /.+/gi;",
|
||||
"",
|
||||
"//Do Not Modify Below",
|
||||
"",
|
||||
" return(testString.match(expression).length);",
|
||||
"})();(function(){return(test);})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
},
|
||||
{
|
||||
"id":"cf1111c1c12feddfaeb8bdef",
|
||||
"name":"Finding WhiteSpace",
|
||||
"dashedName":"waypoint-finding-whitespace",
|
||||
"difficulty":"9.987",
|
||||
"description":[
|
||||
"",
|
||||
"We can also use selectors like <code>\\s</code> to find spaces in a string",
|
||||
"It is used like this:",
|
||||
"<code>/\\s+/g</code>",
|
||||
""
|
||||
],
|
||||
"tests":[
|
||||
"assert(test === 7, 'Your RegEx should have found seven spaces in the testString');",
|
||||
"assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\s+/gi to find the spaces in the testString');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var test = (function(){",
|
||||
" var testString = \"How many spaces are there in this sentance.\";",
|
||||
"",
|
||||
"//Do Not Modify Above",
|
||||
"",
|
||||
" var expression = /.+/gi;",
|
||||
"",
|
||||
"//Do Not Modify Below",
|
||||
"",
|
||||
" return(testString.match(expression).length);",
|
||||
"})();(function(){return(test);})();"
|
||||
],
|
||||
"challengeType": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,30 +1,47 @@
|
||||
[
|
||||
{
|
||||
"id": "bd7167d8c441cbafaeb5bdef",
|
||||
"email": "Ada_Gerlach@gmail.com",
|
||||
"phone": "1-140-557-0727",
|
||||
"company": "Livestream",
|
||||
"country": "Singapore",
|
||||
"city": "Morar berg",
|
||||
"state": "South Dakota",
|
||||
"position": "Junior Backend Developer (Node.js)",
|
||||
"logoUrl": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161",
|
||||
"postingUrl": "https://boards.greenhouse.io/livestream/jobs/59458?t=ek25h0#.VWeTk1xVhBc?source=freecodecamp.com"
|
||||
"logo": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161",
|
||||
"description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life."
|
||||
},
|
||||
{
|
||||
"id": "bd7167d8c442cbafaeb5bdef",
|
||||
"email": "Ada_Gerlach@gmail.com",
|
||||
"company": "Adobe",
|
||||
"country": "Singapore",
|
||||
"city": "Morar berg",
|
||||
"state": "South Dakota",
|
||||
"position": "Junior JavaScript Engineer",
|
||||
"logoUrl": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg",
|
||||
"postingUrl": "https://adobe.taleo.net/careersection/2/jobdetail.ftl?job=32619&lang=en"
|
||||
"logo": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg",
|
||||
"description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life."
|
||||
},
|
||||
{
|
||||
"id": "bd7167d8c443cbafaeb5bdef",
|
||||
"phone": "1-140-557-0727",
|
||||
"company": "Bookspan",
|
||||
"country": "Singapore",
|
||||
"city": "Morar berg",
|
||||
"state": "South Dakota",
|
||||
"position": "Full Stack JavaScript Developer (Junior)",
|
||||
"logoUrl": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe",
|
||||
"postingUrl": "http://bookspan.theresumator.com/apply/10190b666b74087b537f4659756f7c5679000704722064232c1d2e3b2b102501310437/Fullstack-Javascript-Developer-junior?source=freecodecamp.com&sid=zvi9YD9OcHwoDZNgM3XI9uPszGvqxJo6eHf"
|
||||
"logo": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe",
|
||||
"description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life."
|
||||
},
|
||||
{
|
||||
"id": "bd7167d8c444cbafaeb5bdef",
|
||||
"email": "Ada_Gerlach@gmail.com",
|
||||
"company": "Good Eggs",
|
||||
"country": "Singapore",
|
||||
"city": "Morar berg",
|
||||
"state": "South Dakota",
|
||||
"position": "Full Stack Developer",
|
||||
"logoUrl": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg",
|
||||
"postingUrl": "http://www.jobscore.com/jobs2/goodeggs/full-stack-developer/cQ_hd-0USr4Om7eJe4iefn?Board=freecodecamp.com"
|
||||
"logo": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg",
|
||||
"description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life."
|
||||
}
|
||||
]
|
||||
|
@ -1,11 +1,12 @@
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import Fetchr from 'fetchr';
|
||||
import Location from 'react-router/lib/Location';
|
||||
import debugFactory from 'debug';
|
||||
import { app$ } from '../../common/app';
|
||||
import { RenderToString } from 'thundercats-react';
|
||||
|
||||
const debug = debugFactory('freecc:servereact');
|
||||
const debug = debugFactory('freecc:react-server');
|
||||
|
||||
// add routes here as they slowly get reactified
|
||||
// remove their individual controllers
|
||||
@ -25,6 +26,7 @@ export default function reactSubRouter(app) {
|
||||
app.use(router);
|
||||
|
||||
function serveReactApp(req, res, next) {
|
||||
const services = new Fetchr({ req });
|
||||
const location = new Location(req.path, req.query);
|
||||
|
||||
// returns a router wrapped app
|
||||
@ -42,7 +44,7 @@ export default function reactSubRouter(app) {
|
||||
// prefetches data and sets up it up for current state
|
||||
debug('rendering to string');
|
||||
return RenderToString(
|
||||
AppCat(),
|
||||
AppCat(null, services),
|
||||
React.createElement(Router, initialState)
|
||||
);
|
||||
})
|
||||
|
@ -1,8 +1,15 @@
|
||||
import Fetchr from 'fetchr';
|
||||
import getHikesService from '../services/hikes';
|
||||
import getJobServices from '../services/job';
|
||||
import getUserServices from '../services/user';
|
||||
|
||||
export default function bootServices(app) {
|
||||
const hikesService = getHikesService(app);
|
||||
const jobServices = getJobServices(app);
|
||||
const userServices = getUserServices(app);
|
||||
|
||||
Fetchr.registerFetcher(hikesService);
|
||||
Fetchr.registerFetcher(jobServices);
|
||||
Fetchr.registerFetcher(userServices);
|
||||
app.use('/services', Fetchr.middleware());
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ module.exports = function(app) {
|
||||
|
||||
var challengeId = String(req.user.currentChallenge.challengeId);
|
||||
var challengeBlock = req.user.currentChallenge.challengeBlock;
|
||||
// TODO(berks) fix index call here
|
||||
var indexOfChallenge = challengeMapWithIds[challengeBlock]
|
||||
.indexOf(challengeId);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
var Rx = require('rx');
|
||||
var debug = require('debug')('freecc:nonprofits');
|
||||
var observeMethod = require('../utils/rx').observeMethod;
|
||||
var unDasherize = require('../utils').unDasherize;
|
||||
@ -15,18 +16,19 @@ module.exports = function(app) {
|
||||
app.use(router);
|
||||
|
||||
function nonprofitsDirectory(req, res, next) {
|
||||
var sum = 0;
|
||||
findNonprofits({}).subscribe(
|
||||
function(nonprofits) {
|
||||
nonprofits = nonprofits.sort(function(a, b) {
|
||||
return b.moneySaved - a.moneySaved;
|
||||
});
|
||||
totalSavings = function() {
|
||||
for(i = 0; i < nonprofits.length; i++) {
|
||||
sum += nonprofits[i].moneySaved;
|
||||
}
|
||||
return sum;
|
||||
}();
|
||||
findNonprofits({
|
||||
order: 'moneySaved DESC'
|
||||
})
|
||||
.flatMap(
|
||||
(nonprofits = []) => {
|
||||
// turn array of nonprofits into observable array
|
||||
return Rx.Observable.from(nonprofits)
|
||||
.pluck('moneySaved')
|
||||
.reduce((sum, moneySaved = 0) => sum + moneySaved, 0);
|
||||
},
|
||||
(nonprofits = [], totalSavings) => ({ nonprofits, totalSavings })
|
||||
)
|
||||
.subscribe(({ nonprofits, totalSavings }) => {
|
||||
res.render('nonprofits/directory', {
|
||||
title: 'Nonprofits we help',
|
||||
nonprofits: nonprofits,
|
||||
@ -78,8 +80,6 @@ module.exports = function(app) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.render('nonprofits/show', {
|
||||
dashedName: dashedNameFull,
|
||||
title: nonprofit.name,
|
||||
|
@ -1,4 +1,5 @@
|
||||
// use this file with runners like node-debug
|
||||
// or mocha.
|
||||
require('babel/register');
|
||||
var app = require('./server');
|
||||
|
||||
app.start();
|
||||
|
31
server/production-start.js
Normal file
31
server/production-start.js
Normal file
@ -0,0 +1,31 @@
|
||||
// this ensures node understands the future
|
||||
require('babel/register');
|
||||
|
||||
var startTime = Date.now();
|
||||
var timeoutHandler;
|
||||
// this is where server starts booting up
|
||||
var app = require('./server');
|
||||
console.log('waiting for db to connect');
|
||||
|
||||
|
||||
var onConnect = function() {
|
||||
console.log('db connected in %s ms', Date.now() - startTime);
|
||||
if (timeoutHandler) {
|
||||
clearTimeout(timeoutHandler);
|
||||
}
|
||||
app.start();
|
||||
};
|
||||
|
||||
var timeoutHandler = setTimeout(function() {
|
||||
var message =
|
||||
'db did not after ' +
|
||||
(Date.now() - startTime) +
|
||||
' ms connect crashing hard';
|
||||
|
||||
console.log(message);
|
||||
// purposely shutdown server
|
||||
// pm2 should restart this in production
|
||||
throw new Error(message);
|
||||
}, 5000);
|
||||
|
||||
app.dataSources.db.on('connected', onConnect);
|
@ -2,8 +2,7 @@ require('dotenv').load();
|
||||
var pmx = require('pmx');
|
||||
pmx.init();
|
||||
|
||||
var R = require('ramda'),
|
||||
assign = require('lodash').assign,
|
||||
var assign = require('lodash').assign,
|
||||
loopback = require('loopback'),
|
||||
boot = require('loopback-boot'),
|
||||
accepts = require('accepts'),
|
||||
@ -145,7 +144,7 @@ app.use(helmet.csp({
|
||||
'*.d3js.org',
|
||||
'https://cdn.inspectlet.com/inspectlet.js',
|
||||
'http://cdn.inspectlet.com/inspectlet.js',
|
||||
'http://www.freecodecamp.org'
|
||||
'http://beta.freecodecamp.com'
|
||||
].concat(trusted),
|
||||
'connect-src': [
|
||||
'vimeo.com'
|
||||
@ -199,7 +198,6 @@ app.use(
|
||||
})
|
||||
);
|
||||
|
||||
var startTime = Date.now();
|
||||
boot(app, {
|
||||
appRootDir: __dirname,
|
||||
dev: process.env.NODE_ENV
|
||||
@ -249,7 +247,7 @@ var passportOptions = {
|
||||
}
|
||||
};
|
||||
|
||||
R.keys(passportProviders).map(function(strategy) {
|
||||
Object.keys(passportProviders).map(function(strategy) {
|
||||
var config = passportProviders[strategy];
|
||||
config.session = config.session !== false;
|
||||
passportConfigurator.configureProvider(
|
||||
@ -310,8 +308,6 @@ if (process.env.NODE_ENV === 'development') {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = app;
|
||||
|
||||
app.start = function() {
|
||||
app.listen(app.get('port'), function() {
|
||||
app.emit('started');
|
||||
@ -323,34 +319,12 @@ app.start = function() {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = app;
|
||||
|
||||
// start the server if `$ node server.js`
|
||||
// in production use `$npm start-production`
|
||||
// or `$node server/production` to start the server
|
||||
// and wait for DB handshake
|
||||
if (require.main === module) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
var timeoutHandler;
|
||||
console.log('waiting for db to connect');
|
||||
|
||||
var onConnect = function() {
|
||||
console.log('db connected in %s ms', Date.now() - startTime);
|
||||
if (timeoutHandler) {
|
||||
clearTimeout(timeoutHandler);
|
||||
}
|
||||
app.start();
|
||||
};
|
||||
|
||||
var timeoutHandler = setTimeout(function() {
|
||||
var message =
|
||||
'db did not after ' +
|
||||
(Date.now() - startTime) +
|
||||
' ms connect crashing hard';
|
||||
|
||||
console.log(message);
|
||||
// purposely shutdown server
|
||||
// pm2 should restart this in production
|
||||
throw new Error(message);
|
||||
}, 5000);
|
||||
|
||||
app.dataSources.db.on('connected', onConnect);
|
||||
} else {
|
||||
app.start();
|
||||
}
|
||||
}
|
||||
|
12
server/services/job.js
Normal file
12
server/services/job.js
Normal file
@ -0,0 +1,12 @@
|
||||
export default function getJobServices(app) {
|
||||
const { Job } = app.models;
|
||||
|
||||
return {
|
||||
name: 'job',
|
||||
read: (req, resource, params, config, cb) => {
|
||||
Job.find({}, (err, jobs) => {
|
||||
cb(err, jobs);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
30
server/services/user.js
Normal file
30
server/services/user.js
Normal file
@ -0,0 +1,30 @@
|
||||
import debugFactory from 'debug';
|
||||
import assign from 'object.assign';
|
||||
|
||||
const censor = '**********************:P********';
|
||||
const debug = debugFactory('freecc:services:user');
|
||||
const protectedUserFields = {
|
||||
id: censor,
|
||||
password: censor,
|
||||
profiles: censor
|
||||
};
|
||||
|
||||
export default function userServices(/* app */) {
|
||||
return {
|
||||
name: 'user',
|
||||
read: (req, resource, params, config, cb) => {
|
||||
let { user } = req;
|
||||
if (user) {
|
||||
debug('user is signed in');
|
||||
// Zalgo!!!
|
||||
return process.nextTick(() => {
|
||||
cb(null, assign({}, user.toJSON(), protectedUserFields));
|
||||
});
|
||||
}
|
||||
debug('user is not signed in');
|
||||
return process.nextTick(() => {
|
||||
cb(null, {});
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
@ -1,88 +1,105 @@
|
||||
extends ../layout-wide
|
||||
block content
|
||||
script(src='/js/lib/codemirror/lib/codemirror.js')
|
||||
script(src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||
script(src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||
script(src='/js/lib/codemirror/addon/lint/lint.js')
|
||||
script(src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||
script(src='/bower_components/jshint/dist/jshint.js')
|
||||
script(src='/js/lib/chai/chai.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/lib/codemirror.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/lint/lint.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||
script(type='text/javascript', src='/bower_components/jshint/dist/jshint.js')
|
||||
script(type='text/javascript', src='/js/lib/chai/chai.js')
|
||||
link(rel='stylesheet', href='/js/lib/codemirror/lib/codemirror.css')
|
||||
link(rel='stylesheet', href='/js/lib/codemirror/addon/lint/lint.css')
|
||||
link(rel='stylesheet', href='/js/lib/codemirror/theme/monokai.css')
|
||||
link(rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono")
|
||||
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
|
||||
script(src='/js/lib/jailed/jailed.js')
|
||||
script(src='/js/lib/coursewares/sandbox.js')
|
||||
.row
|
||||
.col-xs-12.col-sm-12.col-md-4.bonfire-top
|
||||
script(type='text/javascript', src='/js/lib/codemirror/mode/javascript/javascript.js')
|
||||
script(type='text/javascript', src='/js/lib/jailed/jailed.js')
|
||||
script(type='text/javascript', src='/js/lib/coursewares/sandbox.js')
|
||||
.row(ng-controller="pairedWithController")
|
||||
.col-xs-12.col-sm-12.col-md-4.col-lg-3
|
||||
.scroll-locker
|
||||
#testCreatePanel
|
||||
h1.text-center= name
|
||||
.well
|
||||
#testCreatePanel.well
|
||||
h3.text-center.negative-10= name
|
||||
.row
|
||||
.col-xs-12
|
||||
.bonfire-instructions
|
||||
p.wrappable= brief
|
||||
#brief-instructions
|
||||
#more-info.btn.btn-primary.btn-block.btn-primary-ghost
|
||||
span.ion-arrow-down-b
|
||||
| More information
|
||||
#long-instructions.row.hide
|
||||
.col-xs-12
|
||||
for sentence in details
|
||||
p.wrappable!= sentence
|
||||
#less-info.btn.btn-primary.btn-block.btn-primary-ghost
|
||||
span.ion-arrow-up-b
|
||||
| Less information
|
||||
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||
p.wrappable.negative-10!= sentence
|
||||
.negative-bottom-margin-30
|
||||
#MDN-links
|
||||
p.negative-10 Here are some helpful links:
|
||||
for link, index in MDNlinks
|
||||
.negative-10
|
||||
ul: li: a(href="" + link, target="_blank") !{MDNkeys[index]}
|
||||
if (user)
|
||||
form.form-horizontal(novalidate='novalidate', name='completedWithForm')
|
||||
.form-group.text-center.negative-10
|
||||
.col-xs-12
|
||||
// extra field to distract password tools like lastpass from injecting css into our username field
|
||||
label.negative-10.btn.btn-primary.btn-block#submitButton
|
||||
i.fa.fa-play
|
||||
| Run code (ctrl + enter)
|
||||
.button-spacer
|
||||
.btn-group.input-group.btn-group-justified
|
||||
label.btn.btn-success#trigger-reset-modal
|
||||
i.fa.fa-refresh
|
||||
| Reset
|
||||
label.btn.btn-success#trigger-help-modal
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
label.btn.btn-success#trigger-pair-modal
|
||||
i.fa.fa-user-plus
|
||||
| Pair
|
||||
label.btn.btn-success#trigger-issue-modal
|
||||
i.fa.fa-bug
|
||||
| Bug
|
||||
.spacer
|
||||
.button-spacer
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeOutput(style='display: none;')
|
||||
br
|
||||
#testSuite
|
||||
#testSuite.negative-10
|
||||
br
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var started = Math.floor(Date.now());
|
||||
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var _ = R;
|
||||
var dashed = !{JSON.stringify(dashedName)};
|
||||
.col-xs-12.col-sm-12.col-md-8
|
||||
#mainEditorPanel
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.5.js')
|
||||
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.6.js')
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.zoomIn.fast-animation
|
||||
.modal-content
|
||||
.modal-header.challenge-list-header= compliment
|
||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||
.modal-body(ng-controller="pairedWithController")
|
||||
.modal-body
|
||||
.text-center
|
||||
.animated.zoomInDown.delay-half
|
||||
span.completion-icon.ion-checkmark-circled.text-primary
|
||||
if (user)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next challenge (ctrl + enter)
|
||||
if (points && points > 2)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript" target="_blank")
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge (ctrl + enter)
|
||||
if (user.progressTimestamps.length > 2)
|
||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||
i.fa.fa-twitter  
|
||||
= phrase
|
||||
else
|
||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||
#reset-modal.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeInUp.fast-animation
|
||||
.modal-content
|
||||
.modal-header.challenge-list-header Clear your code?
|
||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||
.modal-body
|
||||
h3 This will restore your code editor to its original state.
|
||||
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
var path = require('path');
|
||||
|
||||
module.exports = {
|
||||
devtool: 'inline-source-map',
|
||||
entry: './client',
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
|
Reference in New Issue
Block a user