Skip to content

Instantly share code, notes, and snippets.

View JonathanZWhite's full-sized avatar
🦁

Jonathan White JonathanZWhite

🦁
View GitHub Profile
let store = {
_users: {},
// creates state tree
_initializeUserState: function(hash) {
this._users[hash] = {
command: '',
spotify: {
genre: '',
numberOfRecs: 0
class Messenger {
...
handleText(msg) {
const message = new Message(Message.mapMessage(msg))
const text = message.text
if (inputParser.isAskingForGenreList(text))
return handlers.music.getGenreList(message, this.bot)
let store = {
...
update: function(hash, data) {
if (!this._users[hash]) this._initializeUserState(hash)
console.log('🌑 => PREVIOUS STATE')
console.log(this.getState(hash))
this._users[hash] = _.merge(this._users[hash], data)
let store = {
...
getState: function(hash) {
if (!this._users[hash]) return this._initializeUser(hash)
return this._users[hash]
},
clearState: function(hash) {
var fallbackMessages = [
'Sorry, not sure what you just said.',
'Uh oh! Try again.',
'Hm... Sorry I\'m not that smart yet. Try again!'
];
var message = messages[Math.floor(Math.random() * messages.length)];
bot.say(message);
var nodemailer = require('nodemailer');
const subscribe = {
send: function(name, service) {
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'your gmail username',
pass: 'your gmail password'
},
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
var subscribe = require('./subscribe');
var app = new express();
var port = 8000;
// middleware
export const fontSize = {
// heading
displayLarge: '32px',
displayMedium: '26px',
displaySmall: '20px',
heading: '18px',
subheading: '16px',
// body
body: '17px',
import React, { PropTypes } from 'react';
import { StyleSheet, css } from 'aphrodite/no-important';
import { tagMapping, fontSize, fontWeight, lineHeight } from '../styles/base/typography';
function Heading(props) {
const { children, tag: Tag } = props;
return <Tag className={css(styles[tagMapping[Tag]])}>{children}</Tag>;
}
export default Heading;
...
export const tagMapping = {
h1: 'displayLarge',
h2: 'displayMedium',
h3: 'displaySmall',
h4: 'heading',
h5: 'subheading',
};