Skip to content

Instantly share code, notes, and snippets.

View ashhitch's full-sized avatar
💭
Slinging Divs

Ash Hitchcock ashhitch

💭
Slinging Divs
View GitHub Profile
@ashhitch
ashhitch / CursorTools.json
Created January 31, 2025 11:05 — forked from ScriptedAlchemy/CursorTools.json
Reverse Engineering cursor prompts
{
"tools": [
{
"type": "function",
"function": {
"name": "codebase_search",
"description": "Find snippets of code from the codebase most relevant to the search query.\nThis is a semantic search tool, so the query should ask for something semantically matching what is needed.\nIf it makes sense to only search in particular directories, please specify them in the target_directories field.\nUnless there is a clear reason to use your own search query, please just reuse the user's exact query with their wording.\nTheir exact wording/phrasing can often be helpful for the semantic search query. Keeping the same exact question format can also be helpful.",
"parameters": {
"type": "object",
"properties": {
@ashhitch
ashhitch / setup.sh
Last active November 9, 2024 22:15 — forked from bradp/setup.sh
New Mac Setup Script
# Get the current hour
current_hour=$(date +"%H")
# Determine the greeting based on the current hour
if [ "$current_hour" -lt 12 ]; then
greeting="Good morning"
elif [ "$current_hour" -lt 18 ]; then
greeting="Good afternoon"
else
greeting="Good evening"
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
#!/bin/bash
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install nvm (Node Version Manager)
echo "Installing nvm..."
@ashhitch
ashhitch / apollo-refreshToken-link.js
Created September 5, 2019 20:27 — forked from alfonmga/apollo-refreshToken-link.js
Apollo refresh auth token link. It tries to refresh user access token on the fly when API throws out an UNAUTHENTICATED error. If multiple requests fails at the same time it queues them to re-try them later if we are able to get a new access token, otherwise we logout the user and redirect him to the login page.
@ashhitch
ashhitch / providerCompose.js
Created April 30, 2019 12:29 — forked from stolinski/providerCompose.js
ProviderComposer
function ProviderComposer({ contexts, children }) {
return contexts.reduceRight(
(kids, parent) =>
React.cloneElement(parent, {
children: kids,
}),
children
);
}
@ashhitch
ashhitch / auth-guard.ts
Created August 9, 2016 13:11 — forked from sonicoder86/auth-guard.ts
Upgrading to the new Angular 2 router - part 11
// auth-guard.ts
import { Injectable } from '@angular/core';
import {
CanActivate,
Router,
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
import { AuthService } from './services/auth/auth.service';
@ashhitch
ashhitch / web-servers.md
Created June 30, 2016 15:26 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ashhitch
ashhitch / bootstrap-em.less
Created October 22, 2015 13:49 — forked from jasny/bootstrap-em.less
Use em or rem font-size in Bootstrap 3
/**
* Use em or rem font-size in Bootstrap 3
*/
@font-size-root: 14px;
@font-unit: 0rem; // Pick em or rem here
// Convert all variables to em
@ashhitch
ashhitch / regex-console.text
Created October 15, 2015 14:26
Remove all console.log from JS in Sublime
Ensure regex button is selected and then type this in the search field.
\s*console\.log(.*);