Skip to content

Instantly share code, notes, and snippets.

View andrewjmead's full-sized avatar

Andrew Mead andrewjmead

View GitHub Profile
@andrewjmead
andrewjmead / app.js
Last active April 6, 2016 22:34
Sequelize Sync Logger
// Other code removed from example
db.sequelize.sync({
force: true,
logging: console.log
}).then(function() {
app.listen(PORT, function() {
console.log('Express listening on port ' + PORT + '!');
});
});
@andrewjmead
andrewjmead / ErrorModal.jsx
Created March 22, 2016 12:49
React Weather ErrorModal.jsx Update
var React = require('react');
var ReactDOM = require('react-dom');
var ReactDOMServer = require('react-dom/server');
var ErrorModal = React.createClass({
getDefaultProps: function () {
return {
title: 'Error'
};
},
@andrewjmead
andrewjmead / app.js
Created March 14, 2016 21:49
Steve DELETE /todo/:id
var cachedTodo;
db.todo.findById(todoId).then(function(todo){
if (todo) {
cachedTodo = todo;
return todo.destroy();
} else {
res.status(404).send('Unable to delete');
}
}).then(function(rows){
@andrewjmead
andrewjmead / package.json
Created March 13, 2016 14:06
Adam - Dev Dependencies
{
"name": "todo-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@andrewjmead
andrewjmead / app.js
Created March 11, 2016 15:30
Kyle Password Manager
console.log('Password Manager started');
var storage = require('node-persist');
var crypto = require('crypto-js');
var argv = require('yargs')
.command('create', 'Create a new account', function(yargs){
return yargs.options({
name: {
demand: true,
alias: 'n',
@andrewjmead
andrewjmead / app.scss
Last active August 18, 2020 04:24
Ben Sidebar
.app-view {
display: flex;
max-width: $size-max-content-width;
margin: 0 auto;
> :first-child {
flex-shrink: 0;
flex-basis: 5rem;
}
@andrewjmead
andrewjmead / app.js
Created March 7, 2016 13:41
Sarvesh - Send email
var sendEmail = function(email) {
var email = {
"From": email.From,
"To": email.To,
"Subject": email.Subject,
@andrewjmead
andrewjmead / index.js
Created March 3, 2016 13:10
Marcus - Export User
export function loginUser(props) {
const request = axios.post(`/users/login`, props);
return request.then((response) => {
var token = response.headers.auth;
localStorage.setItem('token', token); //The user's token is taken from the reponse and set in local storage as 'token'
console.log('Token: ', localStorage.getItem('token'));
}, (response) => {
console.log("Error block in loginUser has been reached");
throw new Error(response.status);
@andrewjmead
andrewjmead / app.js
Created March 2, 2016 02:14
Keith Composite Index Sequelize
var UserTodos = sequelize.define('UserTodos', {
favorite: {
type: Sequelize.BOOLEAN
},
UserId: {
type: Sequelize.INTEGER,
unique: 'compositeIndex'
},
TodoId: {
type: Sequelize.INTEGER,
@andrewjmead
andrewjmead / ShowTodo.jsx
Created February 29, 2016 22:13
Marcus - Show Todo
var ShowTodo = React.createClass({
render: function () {
console.log('rendering ShowTodo');
return (
<div>
<input type="text" onChange={this.textChange}/>
</div>
)
},