Skip to content

Instantly share code, notes, and snippets.

View jschoolcraft's full-sized avatar

Jeff Schoolcraft jschoolcraft

View GitHub Profile
@jschoolcraft
jschoolcraft / .cursorrules
Created August 6, 2024 20:45 — forked from Shpigford/.cursorrules
Cursor Rules
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code.
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices.
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.
- Follow the user’s requirements carefully & to the letter.
@jschoolcraft
jschoolcraft / tabs.rb
Last active April 4, 2022 12:48
Print a markdown formatted list of tabs from all Brave windows
#!/usr/bin/env ruby
# stolen from https://superuser.com/questions/489207/get-the-currently-open-tabs-in-google-chrome-via-the-command-line
window_count = %x(osascript -e 'tell application "Brave Browser" to get number of windows').to_i
exit if window_count == 0
tabs = []
1.upto(window_count).each do |win|
tab_count = %x(osascript -e 'tell application \"Brave Browser\" to get number of tabs in window #{win}').to_i
@jschoolcraft
jschoolcraft / keybase.md
Created January 12, 2021 19:57
keybase.md

Keybase proof

I hereby claim:

  • I am jschoolcraft on github.
  • I am jschoolcraft (https://keybase.io/jschoolcraft) on keybase.
  • I have a public key ASAUWYx5bu3OYmmem0wbCyhaDtjtDsajlWNAM_0Rb5WYHgo

To claim this, I am signing this object:

### Rails app generator template. Run it:
### rails new _app_name_ -m https://gist.githubusercontent.com/DamirSvrtan/28a28e50d639b9445bbc/raw/app_template.rb
bin_setup_file = <<-FILE
#!/bin/sh
bundle install
bundle exec rake db:setup
FILE
create_file 'bin/setup', bin_setup_file
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
# ElasticSearch upstart script
description "ElasticSearch service"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
#!/usr/bin/env bash
# Symlink as ~/bin/dibs for happy fun time excitement.
# Nothing pisses me off more than CTRL-c'ing during an import script
# And just having it fire up the next bloody file to import
trap 'echo Control-C trap caught; exit 1' 2 #traps Ctrl-C (signal 2)
# Exit if there is any errors
set -e
#!/usr/bin/env bash
# Symlink as ~/bin/cache for happy fun time excitement.
DO_REPAIR=0
DEFAULT="2"
LEVEL=$DEFAULT
LEVELS[1]="cache/smarty/templates_c"
LEVELS[2]="cache/modules"
LEVELS[3]="cache/jsLanguage cache/themes"
---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc