# NewRelic instrumenter for GraphQL-ruby | |
# | |
# In your controller: | |
# ::NewRelic::Agent.add_custom_attributes({ | |
# user_id: @user.try(:id), | |
# query_string: @query_string, | |
# query_arguments: @query_variables | |
# }) | |
# | |
# @document = self.class.trace_execution_scoped(["GraphQL#parse"]) do |
When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.
There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the
This guide assumes that you recently run brew upgrade postgresql
and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.
First let's check something.
brew info postgresql
The top of what gets printed as a result is the most important:
Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets
“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important
or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”
You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?
module ActiveRecord | |
module RailsAdminEnum | |
def enum(definitions) | |
super | |
definitions.each do |name, values| | |
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a } | |
define_method("#{ name }=") do |value| | |
if value.kind_of?(String) and value.to_i.to_s == value |
# Customize BASH PS1 prompt to show current GIT repository and branch. | |
# by Mike Stewart - http://MediaDoneRight.com | |
# SETUP CONSTANTS | |
# Bunch-o-predefined colors. Makes reading code easier than escape sequences. | |
# I don't remember where I found this. o_O | |
# Reset | |
Color_Off="\[\033[0m\]" # Text Reset |
package main | |
import ( | |
"fmt" | |
"os" | |
"os/exec" | |
"strings" | |
) | |
type yolUrl struct { |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |