Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Cory Robinson crobinson42

🏠
Working from home
  • American Software
  • Northwest USA
Block or report user

Report or block crobinson42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ExtendedDataStore.js
const { DataStore } = require('js-data')
class ExtendedDataStore extends DataStore {
constructor(props) {
super(props)
if (props.extends)
Object.assign(this, props.extends)
}
}
@crobinson42
crobinson42 / 1.txt
Created Nov 20, 2019
Blog SEO rewrites
View 1.txt
Selling security guard services is admittedly not the sexiest of jobs, but with the right attitude and motivation you can do well both professionally and financially. In order to be great at security guard sales, or sales in general, it requires extensive reading and even more practice. One of the first books that I read and refer back to fairly regularly is The 25 Most Common Sales Mistakes and How to Avoid Them by Stephan Schiffman. Stephan is a Certified Management Consultant who has trained and consulted with corporations such as IBM, Motorola, and Cigna. He has trained over 500,000 professionals across 9,000+ companies. Of the 25 most common mistakes outlined in his book, there are 10 that are essential to anyone involved in security guard sales. I have taken the liberty of summarizing those 10 below.
Mastering Security Guard Sales
Security guard service is one of the most competitive industries that exists (if it isn’t it, sure does feel like it) and losing a sale can be the result of being a pen
@crobinson42
crobinson42 / mongo-to-kafka.js
Last active Oct 11, 2019
Watch mongodb and publish to kafka
View mongo-to-kafka.js
/*
NOTE: this is a naive first attempt at tailing mongo collections to publish kafka messages
and removed module imports and other stuff for brevity....
*/
function normalizeMongoDocument(document) {
// convert "_id" to "id"
const normalized = { id: document._id, ...document }
delete normalized._id
@crobinson42
crobinson42 / Example.jsx
Created Jul 8, 2019
JS-Data React Hook useStoreQuery(mapperName, query)
View Example.jsx
import React from 'react'
import useStoreQuery from './useStoreQuery'
const ActiveUsers = ({ storeQuery, storeQueryLoading }) => {
const { users, loading } = useStoreQuery('users', { where: { active: true } })
return (
<div>{loading ? 'Loading...' : `${users.length} active users found`}</div>
)
View js-data-react.jsx
/* eslint-disable react/no-multi-comp, react/prop-types */
import React from 'react'
import hoistNonReactStatic from 'hoist-non-react-statics'
import shallowEqual from '../utils/shallowEqual'
function ConnectModelsHOC({ loadingProp, modelName, modelNames }, mapPropsWithModels) {
return WrappedComponent => {
class ConnectModels extends React.Component {
static contextType = ''
@crobinson42
crobinson42 / error
Created Mar 27, 2019
kafka-node refreshMetadataError
View error
kafka-node:KafkaClient Connect attempt 1 +0ms
kafka-node:KafkaClient Trying to connect to host: 192.168.0.150 port: 9092 +3ms
kafka-node:KafkaClient kafka-node-client createBroker 192.168.0.150:9092 +1ms
kafka-node:KafkaClient kafka-node-client sending versions request to 192.168.0.150:9092 +902ms
kafka-node:KafkaClient broker socket connected {"host":"192.168.0.150","port":"9092"} +3ms
kafka-node:KafkaClient connected to socket, trying to load initial metadata +2ms
kafka-node:KafkaClient missing apiSupport waiting until broker is ready... +1ms
kafka-node:KafkaClient waitUntilReady [BrokerWrapper 192.168.0.150:9092 (connected: true) (ready: false) (idle: false) (needAuthentication: false) (authenticated: false)] +1ms
kafka-node:KafkaClient Received versions response from 192.168.0.150:9092 +69ms
kafka-node:KafkaClient setting api support to {"21":{"min":0,"max":1,"usable":false},"22":{"min":0,"max":1,"usable":false},"23":{"min":0,"max":2,"usable":false},"24":{"min":0,"max":1,"usable":false},"25":{"min":0,"max
@crobinson42
crobinson42 / ReactotronConfig.js
Created Dec 31, 2018
Reactotron react-native config - redux implementation locking up up
View ReactotronConfig.js
import Reactotron from 'reactotron-react-native';
import sagaPlugin from 'reactotron-redux-saga';
import { reactotronRedux } from 'reactotron-redux';
import envLocal from './.local.json';
export default () => Reactotron
// your local IP goes in .env.local.json (which is in .gitignore)
.configure({ host: envLocal.ip })
// .use(sagaPlugin())
@crobinson42
crobinson42 / index.html
Created Dec 29, 2018
Axios file upload progress indicator
View index.html
<html>
<title>Axios Progress Upload</title>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<input id="file" type="file" name="files" multiple="multiple" /><br />
<br>
<progress id="progress" max="100" value="0"></progress>
View ExtendedDataStore.js
import { DataStore, Mapper } from 'js-data'
class ExtendedDataStore extends DataStore {
as(name) {
const props = {}
// const original = super.as(name)
const mapper = this.getMapper(name)
const self = this
// if "this" is passed instead of "self" the downstream methods fail without straightforward Error stacktrace
View react-final-form-ios-chrome-login.js
<Form
onSubmit={props.handleSubmit}
render={({ handleSubmit, submitting, submitError, values }) => (
<form
className="col-md-8 offset-md-2 col-xs-12 text-center"
onSubmit={handleSubmit}
>
<Field name="email" validate={formValidate.required}>
{({ input, meta }) => (
You can’t perform that action at this time.