Skip to content

Instantly share code, notes, and snippets.

View leonelgalan's full-sized avatar

Leonel Galán leonelgalan

View GitHub Profile
PLAY ***************************************************************************
TASK [setup] *******************************************************************
<192.168.2.2> ESTABLISH SSH CONNECTION FOR USER: leonelgalan
<192.168.2.2> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=leonelgalan -o ConnectTimeout=10 -o ControlPath=/Users/leonelgalan/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.2.2 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1462315718.25-218102911622894 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1462315718.25-218102911622894 `" )'"'"''
<192.168.2.2> PUT /var/folders/q8/mdl09l9d6m38tkk9rjtgq_9r0000gn/T/tmpzw1Ojs TO /home/leonelgalan/.ansible/tmp/ansible-tmp-1462315718.25-218102911622894/setup
<192.168.2.2> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractive
require 'rails_helper'
ActiveModelSerializers.config.schema_path = 'spec/support/schemas'
module ActiveModelSerializers
module Test
module Schema
class AssertSchema
def controller_path
request.filtered_parameters.with_indifferent_access[:controller]
@leonelgalan
leonelgalan / octopus.patch
Created November 11, 2016 20:50
Commit shown on New Relic charts
From 80cb3085f74e18ca983495349320661084780383 Mon Sep 17 00:00:00 2001
From: Leonel Galan <leonelgalan@gmail.com>
Date: Fri, 11 Nov 2016 14:56:14 -0500
Subject: [PATCH] Configure octopus
---
Gemfile | 1 +
Gemfile.lock | 4 ++++
config/initializers/octopus.rb | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+)
@leonelgalan
leonelgalan / rspec.rb
Created November 28, 2016 18:33
Example of lib/active_model_serializers/rspec.rb including ActiveModelSerializers::RSpecMatchers::Schema automatically.
module ActiveModelSerializers
# @api public
# Container module for active_model_serializers specific matchers.
module RSpecMatchers
extend ActiveSupport::Autoload
autoload :Schema, 'active_model_serializers/rspec_matchers/schema'
end
end
RSpec.configure do |config|
@leonelgalan
leonelgalan / codeclimate.sh
Created February 18, 2016 15:23
Setting up Code Climate with Docker/Docker Machine
: Please update Homebrew often and make sure "Your system is ready to brew."
brew update && brew doctor
: Install VirtualBox
brew tap caskroom/cask
brew cask install virtualbox
: Install/Setup Docker
brew install docker
brew install docker-machine
@leonelgalan
leonelgalan / group_count.rb
Created November 7, 2017 20:01
Manipulate Rails' `group(args).count` result into a hash grouped by the `args.first`. See test's `INPUT` and `EXPECTED_OUTPUT`.
# https://github.com/dam13n/ruby-bury
class Hash
def bury(*args)
if args.count < 2
raise ArgumentError, '2 or more arguments required'
elsif args.count == 2
self[args[0]] = args[1]
else
arg = args.shift
@leonelgalan
leonelgalan / README.md
Last active December 13, 2017 18:38 — forked from mikehadlow/README.md
D3js Graph with X and Y crosshairs, and a threshold line.

Example of a D3js time series graph with X,Y crosshairs and a threshold line. Just copy the drawLineGraph function and call it with your data. The data shoud be an array of two element arrays. Something like:

var data = [
    [new Date(2014, 01, 10), 404],
    [new Date(2014, 01, 11), 123],
    [new Date(2014, 01, 12), 666]
    ];
    
var warnLine = { lineValue: 200, label: 'my important threshold' };
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leonelgalan
leonelgalan / README.md
Created November 17, 2014 21:39
Using stackprof and rspec (Rails)
  1. Existing rspec-stackprof is "empty"
  2. stackprof is written as a replacement for perftools.rb
  3. Added an environment variable to conditionally run the profiler, it slows down test runtime by a couple of seconds for me.
  4. Just add stackprof.rb to your spec/support folder, which is loaded on rails_helper.rb