Skip to content

Instantly share code, notes, and snippets.

@kennyfrc
kennyfrc / checkout_fb_pixel
Created September 10, 2017 05:10
facebook checkout purchase tracking code
<script>
fbq('track', 'Purchase', {value: {{ total_price | money_without_currency }}, currency: {{ shop.currency }}});
</script>
@kennyfrc
kennyfrc / railway_oriented_programming_in_ruby.rb
Last active March 3, 2023 16:22
Ruby Example of Railway Oriented Programming
require 'json'
##
# Combinator module
# contains .map, .bind, .apply, .compose
# a toolkit for building functional programs
##
module Combinator
Result = Data.define(:success, :error, :value) do
def call(&block)
@kennyfrc
kennyfrc / apply_patch.py
Last active September 28, 2025 17:50
`apply_patch` implementation for use with GPT-4.1+. initially sourced from the openai cookbook, extended by using the rust `apply_patch` implementation in `openai/codex` as inspiration (it has better feedback with A,M,D updates)
#!/usr/bin/env python3
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field
class ActionType(str, Enum):
ADD = "add"
DELETE = "delete"