Skip to content

Instantly share code, notes, and snippets.

@Snakeyyy
Snakeyyy / SKILL.md
Created June 11, 2026 11:24
prune_tests
name prune_tests
description Review the tests added on the current feature branch and cut the low-value ones, weighing each test's protection against its maintenance cost. Use when the user asks to "cut tests", "prune tests", "review the tests", "are these tests worth keeping", "trim the test suite", or wants to reduce test maintenance before opening/merging a PR. Applies the project's CLAUDE.md testing guidance.

Prune low-value tests on a feature branch

Every test has a carrying cost: it runs on every CI pass and must be maintained when the code changes. Keep a test only when the protection it gives outweighs that cost. This skill reviews the tests this branch added and recommends which to cut.

Principle

@Snakeyyy
Snakeyyy / pj_get_discount.js
Created September 25, 2023 11:40
PartnerJam - get discount - NodeJS
async function createDiscountedCharge(request) {
const [price, planName] = createCharge(request);
const discountToken = request.cookies.partner_jam_token;
if (discountToken) {
try {
const response = await axios.get(\`https://be-app.partnerjam.com/api/v1/discount-check/?token=\${discountToken}\`);
const { discount } = response.data;
if (discount) {
const discountedPrice = price - price * (discount / 100);
@Snakeyyy
Snakeyyy / pj_get_discount.py
Created September 25, 2023 11:38
PartnerJam - Get discount - Python / Django
def create_discounted_charge(request):
price, plan_name = create_charge(request)
if discount_token := request.COOKIES.get('partner_jam_token'):
try:
response = requests.get(
"https://be-app.partnerjam.com/api/v1/discount-check/",
params={
"token": discount_token,
},
)
@Snakeyyy
Snakeyyy / pj_notify_partnerjam.js
Created September 25, 2023 11:34
PartnerJam - example of notifying PartnerJam about successfull installation of the app - NodeJS
const axios = require("axios");
async function installAppView(request) {
// do your logic
const shop = store_shop_data(request);
const appSecret = "<secret>" // obtain this secret in PartnerJam Dashboard in application setup
const token = request.cookies.partner_jam_token;
await axios.post(
"https://be-app.partnerjam.com/webhooks/installation-confirm/",
{
@Snakeyyy
Snakeyyy / pj_notify_partnerjam.py
Created September 25, 2023 11:32
PartnerJam - example of notifying PartnerJam about successfull installation of the app - Python/Django
def install_app_view(request):
# do your logic
shop = store_shop_data(request)
app_secret = '<secret>' # obtain this secret in the code example in PartnerJam dashboard
token = request.COOKIES.get("partner_jam_token")
requests.post(
"https://be-app.partnerjam.com/webhooks/installation-confirm/",
json={
"token": token,
"shopify_id": shop.shopify_id,
@Snakeyyy
Snakeyyy / pj_store_cookie.js
Created September 25, 2023 11:28
PartnerJam - example of an endpoint for storing cookie and redirecting merchant to App Store - NodeJS / Express
@Snakeyyy
Snakeyyy / pj_store_cookie_endpoint.py
Created September 25, 2023 11:25
PartnerJam - example of an endpoint for storing cookie and redirecting merchant to App Store - Python/Django
{% load thumbnail %}
<picture>
<!--[if IE 9]><video style="display: none;"><![endif]-->
{# {% thumbnail image "2000" as im %}#}
<source srcset="{{ image.url }}" media="(min-width: 1000px)">
{# {% endthumbnail %}#}
{% thumbnail image "1600" as im %}
<source srcset="{{ im.url }}" media="(min-width: 800px)">
@responsiveImageUrl = (image_path) ->
if window.devicePixelRatio > 1
isRetina = true
else
isRetina = false
width = $(window).width()
height = $(window).height()
url = '/rimage/?image_path=' + image_path + '&width=' + width + '&height=' + height
if isRetina
from sorl.thumbnail import get_thumbnail
from django.http import HttpResponseRedirect
def responsive_image(request):
image_path = request.GET.get('image_path')
width = int(request.GET.get('width'))
height = int(request.GET.get('height'))
is_retina = bool(request.GET.get('is_retina', False))
if is_retina:
width *= 2