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 / gatsby-image-graphql-toolkit.js
Created June 8, 2021 14:21
Gatsby Image in GraphQL toolkit
exports.createResolvers = function({ actions,cache,createNodeId,createResolvers,store,reporter }) {
const { createNode } = actions;
createResolvers({
HATCH_ContentMediaItemType: {
imageFile: {
type: `File`,
resolve(source, args, context, info) {
return createRemoteFileNode({
url: source.filePath,
@ashhitch
ashhitch / remove-search-yoast.php
Created December 7, 2020 16:20
remove search action Yoast SEO
<?php
add_filter('wpseo_schema_website', 'example_change_website');
function example_change_website($data)
{
if ($data['potentialAction']) {
foreach ($data['potentialAction'] as $key => $value) {
# code...
if ($value['@type'] && $value['@type'] == 'SearchAction') {
unset($data['potentialAction'][$key]);
@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 / sw-src.js
Created June 28, 2018 20:39
workbox
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.3.0/workbox-sw.js');
//{clientsClaim: true}
//console.log('this is my custom service worker');
const revision = 'version-1';
const longerRevision = 'static-1';
//Config
workbox.setConfig({
debug: true
@ashhitch
ashhitch / docker-compose.yml
Last active March 19, 2018 10:53
Wordpress docker file
version: '3'
services:
wordpress:
depends_on:
- db
image: wordpress:4.9.4
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
environment: