Skip to content

Instantly share code, notes, and snippets.

View terrcin's full-sized avatar

terrcin terrcin

View GitHub Profile
@terrcin
terrcin / appsignal_telemetry.ex
Last active April 4, 2022 11:03 — forked from cblavier/appsignal_telemetry.ex
A Phoenix Telemetry agent to monitor all LiveView events & errors
# Add after ExampleWeb.Telemetry to the list of children to be supervised in Application.start
defmodule ExampleWeb.AppsignalTelemetry do
use GenServer
require Appsignal.Utils
import Appsignal.Utils, only: [module_name: 1]
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)
@appsignal_namespace "live_view"
@terrcin
terrcin / setup-statsd.sh
Created June 10, 2011 10:14 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils libapache2-mod-wsgi
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
module ActiveRecord
module Associations
class HasManyThroughAssociation < HasManyAssociation
protected
# added support for STI with polymorphism
def construct_conditions
table_name = @reflection.through_reflection.quoted_table_name
conditions = construct_quoted_owner_attributes(@reflection.through_reflection).map do |attr, value|
if attr =~ /_type$/
construct_polymorphic_sql(table_name, attr)