Skip to content

Instantly share code, notes, and snippets.

Leonel Galán leonelgalan

Block or report user

Report or block leonelgalan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View us-canada.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View chunking.ipynb
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
Last active Dec 13, 2017 — forked from mikehadlow/README.md
D3js Graph with X and Y crosshairs, and a threshold line.
View README.md

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' };
@leonelgalan
leonelgalan / group_count.rb
Created Nov 7, 2017
Manipulate Rails' `group(args).count` result into a hash grouped by the `args.first`. See test's `INPUT` and `EXPECTED_OUTPUT`.
View group_count.rb
# 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 / rspec.rb
Created Nov 28, 2016
Example of lib/active_model_serializers/rspec.rb including ActiveModelSerializers::RSpecMatchers::Schema automatically.
View rspec.rb
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 / octopus.patch
Created Nov 11, 2016
Commit shown on New Relic charts
View octopus.patch
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(+)
View posts_controller_spec.rb
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]
View vvv_output.txt
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
@leonelgalan
leonelgalan / codeclimate.sh
Created Feb 18, 2016
Setting up Code Climate with Docker/Docker Machine
View codeclimate.sh
: 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 / imagemagick.rb
Last active Aug 29, 2015
ImageMagick 6.7.7-10
View imagemagick.rb
require "formula"
class Imagemagick < Formula
homepage "http://www.imagemagick.org"
url "http://www.imagemagick.org/download/releases/ImageMagick-6.7.7-10.tar.xz"
sha256 "85b0f9afe122c52a821001976a4f54ae011bb3d94a87b97e3112e515185731ad"
head "http://www.imagemagick.org/subversion/ImageMagick/trunk"
option "with-quantum-depth-8", "Compile with a quantum depth of 8 bit"
You can’t perform that action at this time.