Skip to content

Instantly share code, notes, and snippets.

View jaredpalmer's full-sized avatar

Jared Palmer jaredpalmer

View GitHub Profile
@jaredpalmer
jaredpalmer / client.js
Created April 3, 2016 15:36
toImmutable
import Immutable, { fromJS } from 'immutable';
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router';
import { createHistory, useQueries } from 'history';
import { Provider } from 'react-redux';
import routes from 'universal/routes';
@jaredpalmer
jaredpalmer / app.js
Created March 24, 2016 17:56 — forked from kevinSuttle/app.js
Gulp, BrowserSync, Sass, Autoprefixer, Nodemon
var express = require('express');
var app = express();
var router = express.Router();
var hbs = require('hbs');
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.use(express.json());
app.use(express.urlencoded());
@jaredpalmer
jaredpalmer / fetchComponentData.js
Created March 18, 2016 03:14
Simple Isomorphic React Resolver
export default function fetchComponentData(dispatch, components, params) {
const needs = components.reduce( (prev, current) => {
return Object.keys(current).reduce( (acc, key) => {
return current[key].hasOwnProperty('needs') ? current[key].needs.concat(acc) : acc
}, prev)
}, []);
@jaredpalmer
jaredpalmer / ContentEditable.js
Created February 15, 2016 16:40
ContentEditable.js
import React from 'react';
export default class ContentEditable extends React.Component {
constructor() {
super();
this.state = {
showPlaceholder: true,
};
this.emitChange = this.emitChange.bind(this);
this.handleClick = this.handleClick.bind(this);
/** @jsx React.DOM */
'use strict';
var React = require('react'),
escapeTextForBrowser = require('react/lib/escapeTextForBrowser'),
{ PropTypes } = React;
var UncontrolledContentEditable = React.createClass({
propTypes: {
component: PropTypes.func,
@jaredpalmer
jaredpalmer / Input.js
Created February 14, 2016 18:50
React Text Editor
import React, { Component, PropTypes } from 'react';
import { Block, Flex } from 'jsxstyle';
import L from '../LayoutConstants';
import TextArea from 'react-textarea-autosize';
class Input extends Component {
constructor() {
super();
this.state = {
focused: false,
@jaredpalmer
jaredpalmer / quip.js
Created December 16, 2015 19:19
Quip Extraction Endpoint for Express API
/**
* POST Extract content from Quip document.
* @param {String} id Quip thread ID
*/
import Q from 'quip.js';
import cheerio from 'cheerio';
const Q = new Quip({
// Quip Access Token (required)
accessToken: "XXXXXX"
@jaredpalmer
jaredpalmer / fbstart.css
Created October 8, 2015 20:56
FBstarter.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline
}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
meta.foundation-version {
font-family: "/5.4.7/"; }
meta.foundation-mq-small {
font-family: "/only screen/";
width: 0em; }
meta.foundation-mq-medium {
font-family: "/only screen and (min-width:40.063em)/";
width: 40.063em; }