Skip to content

Instantly share code, notes, and snippets.

View davidarendsen's full-sized avatar

David Arendsen davidarendsen

  • The Netherlands
View GitHub Profile

🆕 Update: See more extensive repo here: https://github.com/marckohlbrugge/unofficial-37signals-coding-style-guide

The Unofficial 37signals/DHH Rails Style Guide

About This Document

This style guide was generated by Claude Code through deep analysis of the Fizzy codebase - 37signals' open-source project management tool.

Why Fizzy matters: While 37signals has long advocated for "vanilla Rails" and opinionated software design, their production codebases (Basecamp, HEY, etc.) have historically been closed source. Fizzy changes that. For the first time, developers can study a real 37signals/DHH-style Rails application - not just blog posts and conference talks, but actual production code with all its patterns, trade-offs, and deliberate omissions.

@davidarendsen
davidarendsen / HTTPSocket.php
Created August 13, 2019 08:49
DirectAdmin HTTPSocket; retrieving error messages from result body
<?php
/**
* Socket communication class.
*
* Originally designed for use with DirectAdmin's API, this class will fill any HTTP socket need.
*
* Very, very basic usage:
* $Socket = new HTTPSocket;
* echo $Socket->get('http://user:pass@somesite.com/somedir/some.file?query=string&this=that');
@davidarendsen
davidarendsen / mysql_backup.sh
Last active November 30, 2018 15:17
Backup and compress a MySQL database
#!/bin/bash
#
# Use this script to perform a backup of a MySQL database.
#
# The database name
db_name="database1"
# The host name of the MySQL database server; usually 'localhost'
@davidarendsen
davidarendsen / woocommerce-set-tax-class.php
Last active August 15, 2018 13:44
WooCommerce set tax class
<?php
add_filter( 'woocommerce_before_calculate_totals', 'change_cart_items_prices', 10, 1 );
function change_cart_items_prices( $cart_object ) {
$customer = $cart_object->get_customer();
$billing = $customer->get_billing();
foreach ( $cart_object->get_cart() as $cart_item ) {
//Set tax class 'Zero Rate' for businesses outside The Netherlands
@davidarendsen
davidarendsen / soft_deletable.rb
Last active June 22, 2018 13:20
SoftDeletable Model Active Support Concern
module SoftDeletable
extend ActiveSupport::Concern
included do
default_scope { where(:deleted_at => nil) }
scope :with_trashed, -> { unscope(where: :deleted_at) }
scope :only_trashed, -> { unscope(where: :deleted_at).where.not(deleted_at: nil) }
end
def destroy
<?php
/**
* Get's the current "pretty" URI from the URL. It will also correct the QUERY_STRING server var and the $_GET array.
* It supports all forms of mod_rewrite and the following forms of URL:
*
* http://example.com/index.php/foo (returns '/foo')
* http://example.com/index.php?/foo (returns '/foo')
* http://example.com/index.php/foo?baz=bar (returns '/foo')
* http://example.com/index.php?/foo?baz=bar (returns '/foo')
*
@davidarendsen
davidarendsen / .bashrc
Created October 5, 2013 14:47
Customize the command line - .bashrc file
export PATH=~/bin:$PATH
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
@davidarendsen
davidarendsen / image_slider.html
Created September 21, 2012 09:32
Image slider jQuery
<!DOCTYPE HTML>
<html>
<head>
<title>Image Slider jQuery</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script>
function img_slider(number)
{
@davidarendsen
davidarendsen / nested_arrays.php
Created September 17, 2012 14:47
PHP nested arrays
<?php
function recursive($array)
{
if ( is_array($array) )
{
foreach ($array as $key => $row)
{
if ( ! is_array($row) )
{