Skip to content

Instantly share code, notes, and snippets.

View jaredpalmer's full-sized avatar

Jared Palmer jaredpalmer

View GitHub Profile
@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,
/** @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 / 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);
@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 / 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 / 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 / tweet.js
Created April 6, 2016 22:45
send-tweet.js
/*
* Code snippet for posting tweets to your own twitter account from node.js.
* You must first create an app through twitter, grab the apps key/secret,
* and generate your access token/secret (should be same page that you get the
* app key/secret).
* Uses oauth package found below:
* https://github.com/ciaranj/node-oauth
* npm install oauth
* For additional usage beyond status updates, refer to twitter api
* https://dev.twitter.com/docs/api/1.1
@jaredpalmer
jaredpalmer / index.js
Created April 8, 2016 16:40 — forked from netsensei/index.js
Using the Promise library + Fast-CSV to read/write CSV files
var promiseCSV = require('promiseCSV.js');
var path = "in.csv";
var options = { 'headers': true };
promiseCSV(path, options).then(function (records) {
// do other stuff
});
<h4 style="font-size: 16px; font-weight: bold; letter-spacing: .02em; color: #0070ff !important; font-family: -apple-system,BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.4em; margin: 0 0 6px;">TOP STORIES</h4>
/party/:id
/person/:id
id
isActive
firstName
lastName
designation
email
billingAddress {}