Skip to content

Instantly share code, notes, and snippets.


Chris Overstreet chrisoverstreet

View GitHub Profile
View ApiService.ts
type Result<Response> = {
get(): Promise<Response>;
delete(): Promise<Response>;
post(body?: BodyInit): Promise<Response>;
put(body?: BodyInit): Promise<Response>;
patch(body?: BodyInit): Promise<Response>;
type Options = {
headers?: Record<string, string>;
View DbHandler.php
class DbHandler
private $conn;
private $pdo;
* DbHandler constructor.
* Pass in connections to prevent race conditions being cause by multiple connections being created
* @param {mysqli} $dbConnection - optional mysqli connection
* @param {PDO} $pdoConnection - optional pdo connection
View patchEstimateHandler.js
export const patchEstimateHandler = async (req, res) => {
const {
body: { canStartToday },
params: { estimateId },
} = req;
const originalEstimate = await getEstimateById(estimateId);
if (!originalEstimate) {
return responseService.createErrorResponse(res, createError.NotFound());
View UserPermissionsLoader.js
import DataLoader from 'dataloader';
import UserPermission from '../../../models/user-permission.model';
async function batchUserPermissions(userIds) {
const userPermissionListMap = new Map();
const userPermissions = await UserPermission.query()
.select(['userId', 'permission'])
.whereIn('userId', userIds);
View test.jsx
// @flow
// pages/test.jsx
import React from 'react';
import Link from 'next/link';
import LinkButton from '../components/homee-ui/LinkButton';
export default () => (
<Link href="/workbench/[bucket]" as="/workbench/active" passHref>
View LinkButton.jsx
// @flow
import classnames from 'classnames';
import css from 'styled-jsx/css';
import PropTypes from 'prop-types';
import React from 'react';
import type { Node } from 'react';
import Icon from './Icon';
import Text from './Text';
View TimeClock.jsx
// @flow
import React from 'react';
import css from 'styled-jsx/css';
import classnames from 'classnames';
import { useDispatch, useSelector } from 'react-redux';
import { useApolloClient } from '@apollo/react-hooks';
import pluralize from 'pluralize';
import PropTypes from 'prop-types';
import userHasLoginRole from '../../utils/userHasLoginRole';
View homee-pa11y.js
const html = require('pa11y-reporter-html');
const pa11y = require('pa11y');
const fs = require('fs');
const open = require('open');
const [, , url] = process.argv;
(async () => {
console.log(`Signing in as admin user...`);
const results = await pa11y('', {
View Actions.jsx
// @flow
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { useApolloClient } from '@apollo/react-hooks';
import type { Dispatch } from 'redux';
import consumerRequestActions from './consumerRequestActionsMap';
import jobActions from './jobActionsMap';
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->