Skip to content

Instantly share code, notes, and snippets.

View coderberry's full-sized avatar

Eric Berry coderberry

View GitHub Profile
@coderberry
coderberry / ai-challenge-prompt.md
Last active November 15, 2023 22:17
Ruby AI Challenge

You are an expert software engineer that understands all aspects of the Ruby programming language (version 3).

Consider the following tree structure:

.
├── 1
│   ├── 1.1
│   │   ├── 1.1.1
│ │ ├── 1.1.2
@coderberry
coderberry / tailwind_grid_helper.rb
Created September 6, 2023 19:12
Tailwind Grid Helper
module TailwindHelper
# Create a responsive grid. This is necessary in order to make every cell the same size (height & width)
#
# @example
# <%= responsive_grid(total_cells: 3, gap: 3, cols: { xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }, "pt-4") do %>
# <% 3.times do %>
# <%= content_tag(:div, "Cell", class: "h-32 w-full bg-gray-200") %> <-- important to ensure the cell is the same size
# ...
# <% end %>
# <% end %>
@coderberry
coderberry / chatgpt-q1.md
Created June 1, 2023 15:06
ChatGPT explains how to avoid using `send`

Prompt

I have a Rails app with two models that are associated:

class Person < ApplicationRecord
  has_many :pets
  has_many :toys
end
# USAGE: `ruby ask_cpteeves.rb`
# Type "exit" to quit
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'ruby-openai'
gem 'pry'
gem 'tty-prompt'
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "2.7.6"
# Authorization framework for Ruby/Rails application
# [https://github.com/palkan/action_policy]
gem "action_policy", "~> 0.6.4"
# Action Policy integration for GraphQL-Ruby
# Shared collection of (mostly Arel) class-level helpers for working with advanced
# SQL selections.
#
# Source: https://github.com/ManifoldScholar/manifold/blob/84625d40af628646453668be028dabc2aa249516/api/app/models/concerns/arel_helpers.rb#L313
#
# Required rubygem: 'dux'
#
# rubocop:disable Style/CharacterLiteral
# rubocop:disable Style/StringLiterals
# @see https://www.postgresql.org/docs/9.5/static/functions-json.html JSON functions and operators in PostgreSQL
@coderberry
coderberry / github-review-toggle-checkboxes.js
Created December 15, 2022 19:12
Inserts a button that can toggle the "viewed" checkboxes when reviewing a PR on Github.
const url = document.URL;
class ReviewToggle {
insertButton() {
const parentElement = document.querySelector(".pr-review-tools");
let button = document.querySelector('#boost-toggle-checkboxes');
if (!button) {
button = document.createElement("button");
button.id = "boost-toggle-checkboxes";
}
@coderberry
coderberry / ci.yml
Created August 14, 2020 16:30
Using GitHub Actions for CI (rspec + rubocop)
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
RAILS_ENV: test
### Keybase proof
I hereby claim:
* I am coderberry on github.
* I am coderberry (https://keybase.io/coderberry) on keybase.
* I have a public key ASDxOxY4XXIxGp-zouupDGuL3A-bGhziJZ3e6STSnBQaVwo
To claim this, I am signing this object:
@coderberry
coderberry / codefund-sponsorships-faq.md
Last active October 9, 2019 23:57
CodeFund Sponsorships FAQ

CodeFund Sponsorships FAQ

What is CodeFund Sponsorships?

CodeFund Sponsorships is a way to provide funding to open source projects and maintainers. One of the big misconceptions around open source funding is that funding should come from within the community (such as Patreon, Open Collective, and even GitHub Sponsors).

We takes a different approach to the problem. We provide direct sponsorships to GitHub projects and maintainers from companies that wish to share their products and services to the developer ecosystem. The sponsor will be able to track the results of those sponsorships similar to how they do with other marketing efforts. The sponsor will not only fulfill their altruistic desires to support those projects they love, but will also see a return on this investment similar to that found in advertising. This formula encourages more spending which is good for the community.

How does the matchmaking work? Is the list price fixed or can the sponsor negotiate or bid (either up or down)?