Skip to content

Instantly share code, notes, and snippets.

View ericgoodwin's full-sized avatar

Eric Goodwin ericgoodwin

View GitHub Profile
# Use a prefix for the index names that Tire uses so that the test suite doesn't
# stomp on dev data and you can work on multiple apps with ES, but keep tidy
# unadorned names for production.
unless Rails.env.production?
Tire::Model::Search.index_prefix("#{Rails.application.class.parent_name.downcase}_#{Rails.env}")
end
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Railscasts Extended/Railscasts Extended.tmTheme",
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
"...",

Keybase proof

I hereby claim:

  • I am ericgoodwin on github.
  • I am goodwin (https://keybase.io/goodwin) on keybase.
  • I have a public key ASCU1RIneT2ncBlQIHVeGCYOUY647ekmq1WqJ5v99whbXQo

To claim this, I am signing this object:

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

@ericgoodwin
ericgoodwin / postgres-import-export-csv.md
Created May 23, 2019 18:59 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.

@ericgoodwin
ericgoodwin / rabbitmq.rb
Created August 2, 2019 22:41
RabbitMQ Version 3.7.16 Homebrew Install
class Rabbitmq < Formula
desc "Messaging broker"
homepage "https://www.rabbitmq.com"
url "https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.16/rabbitmq-server-generic-unix-3.7.16.tar.xz"
sha256 "a34011f8ff1682a1601d4b8e0167ad39b91fd8f0fb35b484c41efde9f104ed08"
bottle :unneeded
depends_on "erlang"
@ericgoodwin
ericgoodwin / plug.conn.ex
Created April 14, 2020 17:04 — forked from jamonholmgren/plug.conn.ex
Typical Elixir Phoenix Plug.Conn struct contents, in an easy-to-read format. By Jamon Holmgren.
%Plug.Conn{
adapter: {Plug.Adapters.Cowboy.Conn, :...},
assigns: %{
my_assigns: "here"
},
before_send: [
#Function<7.125546534/1 in Phoenix.Controller.fetch_flash/2>,
#Function<1.127904613/1 in Plug.Session.before_send/2>,
#Function<1.43511252/1 in Plug.Logger.call/2>,
#Function<0.70322810/1 in Phoenix.LiveReloader.before_send_inject_reloader/1>
This is a test
@ericgoodwin
ericgoodwin / api_only_rails_example.rb
Created December 4, 2020 20:57 — forked from JoshCheek/api_only_rails_example.rb
How to configure API only Rails (esp how to deal with param parsing).
# I submitted a bug report https://github.com/rails/rails/issues/34244
# b/c Rails was not honouring my `rescue_from` block which was causing my API to
# be inconsistent. I was told this is expected behaviour. I think it's probably
# fine for an HTML app where you control the form inputs. But for an API app,
# the API is public facing and very important, so Rails shouldn't have its own
# special errors that bypass my app's configuration and make my API inconsistent.
#
# Decided it shouldn't be too difficult to handle this myself. So, here is my
# solution. It contains most of the important lessons I've learned about how to
# get a Rails API app setup. It removes Rails' params parsing and adds its own.