Skip to content

Instantly share code, notes, and snippets.

View davetorbeck's full-sized avatar

David Torbeck davetorbeck

View GitHub Profile
@davetorbeck
davetorbeck / cursorrules.html
Created July 22, 2024 07:35 — forked from artsparkAI/cursorrules.html
example of cursorrules (ignore .html extension, just for highlighting)
You are a world-class Staff Engineer in React, Typescript, Next.js and Tailwind CSS. Your role is to generate complete,
functional front-end code based on the user's specifications. Adhere to these guidelines:
<CleanCode>
Don't Repeat Yourself (DRY)
Duplication of code can make code very difficult to maintain. Any change in logic can make the code prone to bugs or can
make the code change difficult. This can be fixed by doing code reuse (DRY Principle).
The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation
@davetorbeck
davetorbeck / App.js
Created July 19, 2019 22:01 — forked from shelldandy/App.js
nprogress with react-router in create-react-app
import React from 'react'
import { BrowserRouter as Router, Switch } from 'react-router-dom'
import routes from './routes'
import FancyRoute from './components/tools/FancyRoute'
const App = props =>
<Router>
<Switch>
{routes.map((route, i) =>
<FancyRoute key={i} {...route} />
@davetorbeck
davetorbeck / bash-cheatsheet.sh
Created December 1, 2018 04:19 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@davetorbeck
davetorbeck / pre-commit
Created November 28, 2018 22:28 — forked from ilyakatz/pre-commit
helpful precommit hooks
#!/bin/bash -l
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
.git/hooks/pre-commit-master-no-no
if [[ $? == 1 ]]
then
@davetorbeck
davetorbeck / pre-commit
Created November 10, 2018 00:37 — forked from arturadib/pre-commit
Pre-commit hook to prevent debug code from being committed
#
# Paste this script in your .git/hooks/pre-commit file (create one if it doesn't exist yet)
# To prevent debug code from being accidentally committed, simply add a comment near your
# debug code containing the keyword !nocommit and this script will abort the commit.
#
if git commit -v --dry-run | grep '!nocommit' >/dev/null 2>&1
then
echo "Trying to commit non-committable code."
echo "Remove the !nocommit string and try again."
@davetorbeck
davetorbeck / watch.js
Created July 24, 2018 05:30
Create-react-app script for watching live changes to build directory
process.env.NODE_ENV = "development"
const fs = require("fs-extra")
const paths = require("react-scripts/config/paths")
const webpack = require("webpack")
const config = require("react-scripts/config/webpack.config.dev.js")
// removes react-dev-utils/webpackHotDevClient.js at first in the array
config.entry = config.entry.filter(
entry => !entry.includes("webpackHotDevClient")
@davetorbeck
davetorbeck / .gitconfig
Last active March 11, 2018 23:39
self explanatory
[user]
name = David T
email = davetorbeck@gmail.com
[core]
excludesfile = /Users/davidtorbeck/.gitignore_global
editor = subl -n -w
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
@davetorbeck
davetorbeck / package.json
Last active March 9, 2018 01:28
sample package.json with test and test-debug
{
"scripts": {
"dev": "webpack-dev-server --open --hot",
"build": "webpack --progress --hide-modules",
"test": "cross-env NODE_ENV=test nyc mocha-webpack --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js",
"test-debug": "cross-env NODE_ENV=test nyc node --inspect-brk ./node_modules/mocha-webpack/lib/cli --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js"
},
}
Documentation:
Enabled: false
Metrics/ModuleLength:
Exclude:
- "**/*_spec.rb"
Style/SymbolArray:
MinSize: 5
Style/EmptyMethod:
@davetorbeck
davetorbeck / pre-commit
Created October 19, 2017 20:53 — forked from Lycisca/pre-commit
Git pre-commit hook to detect some words like binding.pry, debugger...
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log|debugger|binding.pry'
# CHECK
if test $(git diff --cached | grep -E $consoleregexp | wc -l) != 0
then