Skip to content

Instantly share code, notes, and snippets.

View cdaz5's full-sized avatar

Chris D'Ascoli cdaz5

View GitHub Profile
import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
const notNull = (v) => v ? undefined : 'can\'t be null';
const isChris = (v) => v ? undefined : 'can\'t be chris';
const formInputs = [
{
name: 'firstName',
Step 1:
import React, { lazy, Suspense } from 'react';
Step 2:
// change this:
import BusinessList from 'screens/businesses/list';
// to this:
const BusinessList = lazy(() => import('screens/businesses/list'));
import React from 'react';
import debounce from 'lodash/debounce';
import { InfinitePanel } from '../shared';
const withInfiniteScroll = WrappedComponent => class InfiniteScroll extends WrappedComponent {
constructor(props) {
super(props);
this.infiniteRef = React.createRef();
this.debouncedHandleInfiniteScroll = debounce(this.handleInfiniteScroll, 150);
}
import React from 'react';
import ReactDOM from 'react-dom';
import { Router } from 'react-router-dom';
import { Provider } from 'react-redux';
import history from './config/history';
import httpService from './services/httpService';
import configureStore from './state/store';
import App from './App';
@cdaz5
cdaz5 / gist:b9dd9914063f090e527fbb7708fcb097
Last active February 12, 2019 22:42
httpInterceptors
import axios from 'axios';
import { authOperations } from 'where you keep your actions/operations';
// whats a tutorial without an obscure authService :)
import authService from './authService';
const httpService = {
// we pass the redux store and history in order to dispatch the logout actions
// and push the user to login
app.controller('MainController', ['$scope', 'places', function($scope, places){
$scope.mapCenter = { lat: 40.741934, lng: -74.004897, zoom: 17 }
console.log('init')
places.success(function(data){
console.log('data', data)
$scope.geodata = data;
$scope.mapMarkers = geodataToMarkers($scope.geodata);
});
}]);
<head>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet" />
<link href="css/leaflet.css" rel="stylesheet" />
<script src='js/vendor/angular.min.js'></script>
<script src='js/vendor/leaflet.js'></script>
`Hello, my name is ${this.name}` <---- this ... rather than this ---> 'Hello, my name is ${this.name}'
const imAnObj = {
thisIsAKeyThatPointsToAnotherObj: {
anotherObj: 'This is cray'
}
}
<div class="main" ng-controller="MainController">
<program-listing listing="program"></program-listing>
</div>