This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The crypto module is part of node and does not need to be installed via npm | |
| require('crypto').randomBytes(48, function(ex, buf) { | |
| var token = buf.toString('hex'); | |
| console.log(token) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var description = 'something Here'; | |
| Todo.findOne({ | |
| where: { | |
| $and: [ | |
| Sequelize.where(Sequelize.fn('lower', Sequelize.col('description')), sequelize.fn('lower', description)) | |
| ] | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| entry: './public/index.js', | |
| output: { | |
| path: __dirname, | |
| filename: './public/bundle.js' | |
| }, | |
| resolve: { | |
| extensions: ['', '.js', '.jsx'] | |
| }, | |
| module: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var middleware = { | |
| logger: function(req, res, next) { | |
| console.log(new Date().toString()); | |
| console.log('Request: ' + req.method + req.originalUrl); | |
| next(); | |
| }, | |
| requireAuthentication: function(db) { | |
| return function(req, res, next) { | |
| var token = req.get('Auth'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Be careful which directory this is executed in | |
| find . -name Icon? -exec rm -rf {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var accounts = []; | |
| function createAccount(userName_, initialBalance_) { | |
| var account = { | |
| balance: initialBalance_ || 0, | |
| userName: userName_ || ' ' | |
| }; | |
| accounts.push(account); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component, PropTypes } from 'react'; | |
| import { reduxForm } from 'redux-form'; | |
| import { connect } from 'react-redux'; | |
| import LogoutHeader from 'LogoutHeader'; | |
| import { fetchTodo, updateTodo, deleteTodo } from 'Actions'; | |
| import { Link } from 'react-router'; | |
| var contextTypes = { | |
| router: PropTypes.object | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ReactDOM.render( | |
| <Router history={hashHistory}> | |
| <Route path="/docs" component={Main}> | |
| <Route path="/page-one" component={PageOne}/> | |
| <Route path="/page-two" component={PageTwo}/> | |
| <IndexRoute component={DocHome}/> | |
| </Route> | |
| </Router>, | |
| document.getElementById('app') | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ShowTodo = React.createClass({ | |
| render: function () { | |
| console.log('rendering ShowTodo'); | |
| return ( | |
| <div> | |
| <input type="text" onChange={this.textChange}/> | |
| </div> | |
| ) | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var UserTodos = sequelize.define('UserTodos', { | |
| favorite: { | |
| type: Sequelize.BOOLEAN | |
| }, | |
| UserId: { | |
| type: Sequelize.INTEGER, | |
| unique: 'compositeIndex' | |
| }, | |
| TodoId: { | |
| type: Sequelize.INTEGER, |