Skip to content

Instantly share code, notes, and snippets.

View pdmholden's full-sized avatar

Paul Holden pdmholden

View GitHub Profile
@pdmholden
pdmholden / webp_main.rb
Created July 26, 2023 21:43
Test for JPEG to WEBP conversion in ActiveStorage
# frozen_string_literal: true
# Rails 7.1.0.alpha
# Ruby 3.2.2
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
@pdmholden
pdmholden / interesting-podcasts.md
Last active February 12, 2018 00:27
Quick notes from interesting tech podcasts
@pdmholden
pdmholden / ruby-rails-cheat-sheet.md
Last active April 8, 2017 19:35
Things I keep forgetting

Public/Private/Protected

This is all about the receiver.

  • Public is the simple case, these messages can be sent to any receiver, explicit or implicit.
    • Explicit: var_name.method_name; self.method_name.
    • Implicit: (inside a class, just calling method_name) because the receiver is self even though it's not "mentioned"
  • Private methods, the receiver is always self. It is not possible to call var_name.method_name, ie, only implicit invocation is possible.
    • The result is that these methods can only be called (with implicit receiver) from within the class in which they are defined. But this is not about information hiding, it is about the receiver of the message.
  • Protected methods are like private except that explicit receivers are allowed when the message is sent from a class of the same type.
@pdmholden
pdmholden / rspec-cheat-sheet.md
Last active January 13, 2021 09:18
RSpec Cheat Sheet

This is a cheat sheet for RSpec, including its methods, and test doubles. It also includes FactoryGirl methods, even though that is separate from RSpec. This cheat sheet is based on Rails 4 Test Prescriptions by Noel Rappin (the best of a bad lot when it comes to RSpec books) and the RSpec documentation published on Relish. RSpec documentation is generally not very good, which is why I created this cheat sheet for myself.

General

Stubs

@pdmholden
pdmholden / camera-proj.txt
Last active November 6, 2015 05:41
Possibly useful libraries
API levels:
Nexus S: 10 (6%)
Nexus 7: 17 (18%)
? 19 (39%)
Cameras:
Open Camera
http://opencamera.sourceforge.net/
http://sourceforge.net/p/opencamera/code/ci/master/tree/