Skip to content

Instantly share code, notes, and snippets.

View jeffskelton3's full-sized avatar
:shipit:

Jeff Skelton jeffskelton3

:shipit:
View GitHub Profile
function frg {
result=$(rg --ignore-case --color=always --line-number --no-heading "$@" |
fzf --ansi \
--color 'hl:-1:underline,hl+:-1:underline:reverse' \
--delimiter ':' \
--preview "bat --color=always {1} --theme='OneHalfDark' --highlight-line {2}" \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3')
file=${result%%:*}
linenumber=$(echo "${result}" | cut -d: -f2)
if [[ -n "$file" ]]; then
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/stylist-api',
createProxyMiddleware({
target: 'http://localhost:3000',
changeOrigin: true,
})
);
// import segment from 'segment'
const segment = {
init: () => console.log("initialized!!"),
trackEvent: (eventName: string, data: any) => console.log(data),
};
interface SegmentEvent {
name: string;
data: {};
interface HttpClient<Response, Options extends {} = {}> {
get: (url: string, options: Options) => Promise<Response>;
put: (url: string, options: Options) => Promise<Response>;
post: (url: string, options: Options) => Promise<Response>;
}
interface CurrencyFormatter {
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ -n "${TRACE-}" ]]; then
set -o xtrace
fi
if [[ "$1" =~ ^-*h(elp)?$ ]]; then
# unbind Ctrl+B as the default meta and instead use Ctrl+A
unbind C-b
set -g prefix C-a
set -g pane-border-status top
# split panes using | and -
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
import React, { useRef } from 'react';
interface WidgetProps {
url: string;
onWidgetReady: (api: any) => void;
}
type UnsubscribeCallback = Function;
type Subscribe = <T = string>(
const ele = document.getElementsByTagName('ul')[0];
ele.addEventListener('mouseup', () => {
const element = document.createElement("span");
element.className = 'highlight';
const textToHighLight = window.getSelection();
const range = textToHighLight.getRangeAt(0);
range.surroundContents(element);
// console.log(textToHighLight);
});
const contents = `
afder is bar and baz is {{biz}} {shouldnt find}{{but_this_should}}
{{blah}}
`;
const parseDatabaseFields = (input) => {
const pattern = '\{\{(.*?)\}\}';
const regex = new RegExp(pattern, 'gm');
let match;
const matches = [];
@jeffskelton3
jeffskelton3 / getAllTextInsideHandleBars.es6
Created February 27, 2019 18:17
looks through a block of text and returns all text that lives inside of handlebars along with its start/end index
const parseDatabaseFields = (input) => {
const pattern = '\{\{(.*?)\}\}';
const regex = new RegExp(pattern, 'gm');
let match;
const matches = [];
while ((match = regex.exec(input)) !== null) {
matches.push({
name: match[0],
value: match[1],
startIndex: match.index,