Skip to content

Instantly share code, notes, and snippets.

View robwelan's full-sized avatar

Rob Welan robwelan

View GitHub Profile
@robwelan
robwelan / git-push-existing-folder.bat
Last active September 25, 2019 08:34
git-push-existing-folder
cd existing_folder
git init
git remote add origin git@[YOUR_PROJECT_FOLDER].git
git add .
git commit -m "Initial commit"
git push -u origin master
import React from 'react';
import { getMyLocation } from '../utilities';
const withLocation = (WrappedComponent) => (
class extends React.Component {
constructor(props) {
super(props);
this.state = {
accuracy: null,
@robwelan
robwelan / getMyLocation.js
Created October 13, 2019 23:57
How to get location from the navigator (browser window). These are the utility functions for use with reactjs-hoc-browser-location.jsx
const getLocation = () => {
const options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0,
};
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
@robwelan
robwelan / cot-blog-react-component-parallax.jsx
Last active October 14, 2019 07:33
parallax gist (gist:robwelan/e2a4f838c23d01e12067d2bff2abca34#cot-blog-react-component-parallax.jsx)
import React from 'react';
import PropTypes from 'prop-types';
import validation from '../../utilities/validation/parallax';
const Parallax = (props) => {
const {
alpha,
blue,
children,
green,
@robwelan
robwelan / cot-blog-utilities-validation-parallax.js
Last active October 14, 2019 07:48
the utility referenced by cot-blog-react-component-parallax.jsx (gist:robwelan/14354bd8394cea0a9162a401ba3683be#cot-blog-utilities-validation-parallax.js)
const validation = {
default: {
color: 255,
alpha: 0.4,
},
color(color) {
let validColor = this.default.color;
if (!Number.isNaN(color)) {
if (color < 0) {
import PropTypes from 'prop-types';
import React from 'react';
import Load from 'external-load';
import Loadable from 'react-loadable';
import CircularProgress from '@material-ui/core/CircularProgress';
// Children
import Map from './map';
.pin-label {
font-size: 0.7rem;
margin: 0;
position: relative;
top: -9px;
left: 2px;
}
import PropTypes from 'prop-types';
import React from 'react';
import MapGL, { Marker } from 'react-map-gl';
import PinDropIcon from '@material-ui/icons/PinDrop';
// Styles
import './map.css';
const token = process.env.GATSBY_MAPBOX_API;
@robwelan
robwelan / cot-blog-set-up-mongodb.js
Last active December 5, 2019 23:56
cot-blog-set-up-mongodb.js
// In your gatsby-config.js
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
});
module.exports = {
plugins: [
{
resolve: 'gatsby-source-mongodb',
options: {
<table style="width:100%" border="0">
<thead>
<tr>
<th>Field Name</th>
<th>Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>