Skip to content

Instantly share code, notes, and snippets.

import React, {Component} from 'react'
import {connect} from 'react-redux'
import {addFoo} from '../actions/foo'
class MyComponent extends Component {
static defaultProps = {
foos:[]
}
state = {
import axios from 'axios'
function api(user, pass) {
return axios.create({
'X-User':user,
'X-Password':pass
})
}
let fields = document.querySelector('#fields')
let htmlStr = '<form>'
formData.forEach(function(item){
if (item.type === 'text' || item.type === 'email' || item.type === 'tel') {
htmlStr += `<input type="${item.type}" placeholder="${item.label}" id="${item.id}" />`
}
if (item.type === 'textarea') {
htmlStr += `<textarea id="${item.id}" placeholder="${item.label}"></textarea>`
@overthemike
overthemike / App.js
Created May 13, 2017 05:48 — forked from fdidron/App.js
React Router v4 Auth
//Usage
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Route from './AuthRoute';
import Login from './Login';
import Private from './Private';
export default () =>
<Router>
// make sure to yarn add jquery
import $ from 'jquery'
import store from './store'
function getData() {
$.getJSON('https://api.etsy.com/v2/listings/active.js?api_key=h9oq2yf3twf4ziejn10b717i&keywords=whiskey&includes=Images,Shop&callback=?', function(data){
store.dispatch({
type: 'GET_DATA',
action: data.results
})
import React, {Component} from 'react';
import FontIcon from 'material-ui/FontIcon'
import {cyan500} from 'material-ui/styles/colors'
const remote = require('electron').remote
const dialog = remote.require('dialog')
class PhotoHover extends Component {
constructor(props) {
super(props)
import React from 'react';
export default React.createClass({
getInitialState: function() {
return {
list: [],
text: ''
}
},
fail @ assert.js:85
ok @ assert.js:105
Module.require @ module.js:481
require @ internal/module.js:20
(anonymous function) @ external {"O_RDONLY":0,"O_WRONLY":1,"O_RDWR":2,"S_IFMT":61440,"S_IFREG":32768,"S_IFDIR":16384,"S_IF…:1
__webpack_require__ @ bootstrap 3a92b96…:555
fn @ bootstrap 3a92b96…:86
(anonymous function) @ polyfills.js:2
__webpack_require__ @ bootstrap 3a92b96…:555
import _fs from 'fs'
import {encrypt, decrypt} from './encryption'
import low from 'lowdb'
export default class ReadWrite {
constructor(datafile, key) {
this.key = key
this.datafile = datafile
this.db = low(datafile, {
deserialize: (str) => {
select usernames.* from (
select u.username, u.id, p.first_name, p.last_name, p.avatar, p.political_affiliation
from users u
join profiles p on p.user_id = u.id
join messages mf on mf.from_profile_id = p.id
join messages mt on mt.to_profile_id = p.id
where
mf.from_profile_id = (select p.id from users u
join profiles p ON u.id = p.user_id
join tokens t ON t.user_id = u.id