Skip to content

Instantly share code, notes, and snippets.

View rjhilgefort's full-sized avatar

Rob Hilgefort rjhilgefort

View GitHub Profile
@rjhilgefort
rjhilgefort / colorls-alias.sh
Last active February 7, 2023 16:22
https://github.com/athityakumar/colorls beautifies your `ls` and adds icons!
# Enable tab completion of flags
source $(dirname $(gem which colorls))/tab_complete.sh
# Move standard ls
alias ols="ls"
# Base formats
alias ls="colorls -A" # short, multi-line
alias ll="colorls -1A" # list, 1 per line
alias ld="ll" # ^^^, NOTE: Trying to move to this for alternate hand commands
alias la="colorls -lA" # list w/ info
@rjhilgefort
rjhilgefort / Readme.md
Last active November 9, 2022 22:17 — forked from mrgcohen/Readme.md

Requirements

  • bootstrap with typeahead
  • jquery

Explanation

This will use bootstrap with typeahead to create an autocomplete search.

const isNegative = (num) => Math.sign(num) === -1
const isPositive = (num) => Math.sign(num) === 1 || Math.sign(num) === 0
const offsetString_from_number = (data) => {
const data_ = Math.abs(data).toString().padStart(2, '0').concat(':').padEnd(5, '0')
return isNegative(data) ? `-${data_}` : `+${data_}`
}
offsetString_from_number(-5)
offsetString_from_number(+5)
export const poop =
({ prismaClient }: { prismaClient: PrismaClient }) =>
<T extends Prisma.IncidentFindManyArgs>(
slackChannelId: ChannelId,
args?: Prisma.SelectSubset<T, Prisma.IncidentFindManyArgs>,
) => {
const args_ = { ...args, where: { slackChannelId } } as Prisma.SelectSubset<
T,
Prisma.IncidentFindManyArgs
>
import { tap, prop, chain, invoker, map } from 'ramda';
// https://monet.github.io/monet.js/
import { Maybe, Just, Some } from 'monet';
// https://github.com/fluture-js/Fluture
import { encaseP, fork } from 'fluture';
const { log, error } = console;
const fetchF = (...args) =>
encaseP(fetch)(...args)
export const NonEmptyStrT = new t.Type<string, string, unknown>(
'NonEmptyStrT',
(input): input is string => typeof input === 'string',
(input, context) =>
typeof input === 'string' &&
pipeVal(input, trim, allPass([isString, isNotEmpty]))
? right(input)
: t.failure(input, context, 'string cannot be empty'),
t.identity,
)
import { isArray, curry, isPlainObject, isFunction, isNil } from 'lodash/fp'
import { mapValuesWithKey } from './mapValuesWithKey'
import { mapWithKey } from './mapWithKey'
const iteratee = (spec, full) => (val, key) => fn(spec[key], val, full)
const fn = (spec, data, full) => {
if (isNil(spec)) return data
if (isFunction(spec)) return spec(full)
if (isPlainObject(spec)) return mapValuesWithKey(iteratee(spec, full), data)
// input array of words - ['tea', 'eat', 'ate', 'leap', 'peak', 'foo', 'bar']
// output - [ ['eat', 'ate', 'tea'], ['foo'], {'bar'}, {'leap', 'peal'}]
const foo = (words) => {
const wordsGrouped = words.reduce(
(acc, word) => {
const sortedWord = word.split('').sort().join('')
// Make sure we have an entry for this sorted word
if (!acc[sortedWord]) {
import React, { FC, CSSProperties } from 'react'
import { string, number, object, shape } from 'prop-types'
import { getTheme, GetThemeProps } from '@dcf/theme'
import { baseIcons } from './iconMapping'
type P = {
icon: string
size?: number
viewBox?: string
import { curry } from 'lodash/fp'
import PropTypes, { func, shape } from 'prop-types'
const args = {
openEntity: func.isRequired,
closeEntity: func.isRequired,
gridApi: shape({
getDisplayedRowCount: func.isRequired,
isQuickFilterPresent: func.isRequired,
}).isRequired,