Skip to content

Instantly share code, notes, and snippets.

@badnorseman
badnorseman / .babelrc
Last active October 31, 2016 20:27
webpack-react
{
"presets": ["es2015", "react"]
}
@badnorseman
badnorseman / index.js
Created May 22, 2016 18:50
An OOP example
'use strict'
const express = require('express')
const bodyParser = require('body-parser')
const todos = require('./todos')
require('./env')
const app = express()
app.use(bodyParser.json())
app.use(express.static('public'))
@badnorseman
badnorseman / Facebook.js
Last active September 12, 2020 14:17
Embed Facebook SDK into React app
"use strict";
import { connect } from "react-redux";
import { oauth } from "../../actions/auth_actions";
import "./facebook.css";
const Facebook = ({ dispatch }) => (
<button
className="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect facebook"
onClick={ev => {
ev.preventDefault();
Rails app
http://docs.railsbridge.org/job-board/job-board
PostgreSQL
https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres
http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/
https://kkob.us/2016/01/09/homebrew-and-postgresql-9-5/
Rails routing
http://guides.rubyonrails.org/routing.html
@badnorseman
badnorseman / webpack.config.js
Created November 7, 2016 18:34
Webpack for development
var path = require("path");
var webpack = require("webpack");
module.exports = {
devtool: "eval-source-map",
entry: [
"webpack-hot-middleware/client",
"./src/scripts/App.js"
],
output: {
@badnorseman
badnorseman / app.js
Created November 19, 2016 23:17 — forked from datchley/app.js
"Getting Functional with Javascript" Blog post source files
/**
* Primary application logic for our Functional Programming blog example
* See related blog series at: http://www.datchley.name/tag/functional-programming/
* Version: 2.0
*/
// A simple, resuable comparison for '>='
function greaterThanOrEqual(a, b) {
return a >= b
}
@badnorseman
badnorseman / googleMaps.js
Created January 26, 2017 22:15
GoogleMaps
const googleMapsClient = require('@google/maps').createClient({
key: process.env.GOOGLE_SERVER_KEY,
});
module.exports.placesAutoComplete = (input, type) =>
new Promise((resolve, reject) =>
googleMapsClient.placesAutoComplete({
input,
type,
}, (error, res) => {
@badnorseman
badnorseman / inputField.js
Created February 2, 2017 14:06
React Input
"use strict";
import React, { Component, PropTypes } from "react";
import { render } from "react-dom";
class Inputfield extends Component {
constructor(props) {
super(props);
this.state = { value: this.props.value };
this.handleChange = this.handleChange.bind(this);
}