Skip to content

Instantly share code, notes, and snippets.


Alvaro Garcia alvarogarcia7

View GitHub Profile
alvarogarcia7 / screenshot_after_failure.rb
Created Sep 27, 2017
Take a screenshot after a failure in Ruby, using Capybara
View screenshot_after_failure.rb
After do |scenario|
diff = ( - time)
timings << { scenario:, timing: diff }
if scenario.failed?
Capybara.using_session(Capybara::Screenshot.final_session_name) do
filename_prefix = Capybara::Screenshot.filename_prefix_for(:cucumber, scenario)
saver =,, true, filename_prefix)
alvarogarcia7 / repl_history.clj
Created Aug 3, 2017
Playing with group-by and destructuring
View repl_history.clj
(def numbers [0 1 2 3 4 5 6 7 8 9])
=> #'es.joaquincaro.katas.Greeting/numbers
(filter odd? numbers)
=> (1 3 5 7 9)
(group-byodd? numbers)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: group-byodd? in this context, compiling:(/private/var/folders/6p/p1cct37x19bgtnss368w24mm0000gn/T/form-init4565011324126899375.clj:1:1)
(group-by odd? numbers)
=> {false [0 2 4 6 8], true [1 3 5 7 9]}
(let [[pares even? impares odd?]] (group-by odd? numbers))
IllegalArgumentException let requires an even number of forms in binding vector in es.joaquincaro.katas.Greeting:1 clojure.core/let (core.clj:4333)

Keybase proof

I hereby claim:

  • I am alvarogarcia7 on github.
  • I am alvarogarcia ( on keybase.
  • I have a public key whose fingerprint is 317C 7705 8F59 B6A4 1793 7276 C2E9 0DD2 532C 9136

To claim this, I am signing this object:

alvarogarcia7 / better_image_tag.rb
Created Jun 9, 2016 — forked from pichfl/better_image_tag.rb
Liquid Image Tag for Jekyll
View better_image_tag.rb
# Source is
# A simple plugin for Jekyll that allows you to use {% img url "alt text" %} to add images to your posts.
# It will automatically check those images for width and height.
# Requires
require 'image_size'
require 'open-uri'
module Jekyll
View coding-dojo-MOW.txt
We will practice a programming problem, in pairs.
This time we'll do the Attack of the Comments Kata. Formulation is here:
Each pair will choose a programming language and will practice TDD.
At the end of the programming part, we will get together and discuss our solutions, pros and cons of each one.
After that, we will gather feedback about it for following sessions.
alvarogarcia7 / next-read-chooser.js
Created Jan 27, 2016
Choose the next item in pocket (
View next-read-chooser.js
var items = $(".item_link");
var size = items.size();
var nextLinkIndex = Math.floor((Math.random() * size));
var nextLink = items[nextLinkIndex];
//enable pop-ups if you have links to twitter or similar;
alvarogarcia7 / pertree.clj
Last active Sep 23, 2015
Persisted tree kata
View pertree.clj
(defn mktree
([label l r] (cons label (cons l r)))
([leaf] (cons leaf (cons nil nil))))
(defn getlabel [t] (first t))
(defn getchildren [t] (rest t))
(defn getleft [t] (first (getchildren t)))
(defn getright [t] (rest (getchildren t)))
(defn find_ [t node]
(let [root (getlabel t)]
View Default (Windows).sublime-keymap
{ "keys": ["f5"],
"command": "insert_date",
"args": {"format": "%Y%m%d-%H%M%S AGB"} } // for python's date reference, take a look at this:
alvarogarcia7 / .bashrc
Created Feb 26, 2015
my git CLI settings as of 20150226-0807
View .bashrc
# [...]
# only the part part of it that relates to git
alias g=git
# [...]
alvarogarcia7 / discussion-code-review
Created Feb 7, 2015
Java snippet for code review - purpose: cli application for adding all numbers that come as parameters
View discussion-code-review
public class Main {
// See
public static void main(String[] args){
int a = Integer.parseFrom(args[0]);
int b = Integer.parseFrom(args[2]);
int c = Integer.parseFrom(args[1]);
System.out.println(a + b + c);