Skip to content

Instantly share code, notes, and snippets.

View elgalu's full-sized avatar

Leo Gallucci elgalu

View GitHub Profile
@elgalu
elgalu / dconf-custom-keybindings.sh
Created January 22, 2016 14:38
Sample custom key bindings through dconf-tools cli
# requirements
sudo apt-get install -qyy dconf-tools
# careful, if you already have custom hotkeys this commands will overwrite the first 7 ...
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name "'SouthWest(7)0,1080'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding "'<Primary><Super>a'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command "'wmctrl -r :ACTIVE: -e 7,0,1080,-1,-1'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/name "'SouthEast(9)1920,1080'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/binding "'<Primary><Super>d'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/command "'wmctrl -r :ACTIVE: -e 9,1920,1080,-1,-1'"
@elgalu
elgalu / .jhbuildrc
Created July 25, 2014 20:41
Install gnome-terminal from source
# -*- mode: python -*-
#
# policy for modules to build, options are:
# - all: build everything requested
# - updated: build only modules that have changed
# - updated-deps: build modules that have changed, or their dependencies
# have changed.
build_policy = 'updated'
# moduleset settings:
@elgalu
elgalu / waitAbsent.js
Created November 27, 2014 16:35
Actively wait for an element to disappear either by becoming invisible or by not being present. Wait up to specTimeoutMs ignoring useless webdriver errors like StaleElementError.
/**
* Actively wait for an element to disappear either by becoming
* invisible or by not being present. Wait up to specTimeoutMs
* ignoring useless webdriver errors like StaleElementError.
*
* Usage:
* Add `require('./waitAbsent.js');` in your onPrepare block or file.
*
* @example
* expect($('.some-html-class').waitAbsent()).toBeTruthy();
@elgalu
elgalu / write_expectation.rb
Last active May 9, 2019 08:39
An RSpec expectation to test text written to standard output and standard error
require 'rspec'
require 'stringio'
# Custom matcher to test text written to standard output and standard error
#
# @example
# expect { $stderr.puts "Some random error" }.to write(/Some.* error/).to(:stderr)
#
# @example
# expect { $stderr.puts "Some specific error" }.to write('Some specific error').to(:stderr)
@elgalu
elgalu / metaprogramming_ruby_quiz.rb
Created December 6, 2012 04:00
My quiz on: Metaprogramming Ruby: Program Like the Ruby Pros by Paolo Perrotta
- Returns?
module Module
def const_missing(name)
"sorry i don't have #{name} yet"
end
end
Untitled #=> ?
Monkeys #=> ?
=>
You get `TypeError: Module is not a module` before reaching Untitled code
@elgalu
elgalu / Dockerfile
Last active June 27, 2018 14:04
Troubleshooting UnsatisfiableError on mro and
# Ubuntu 18:04
FROM registry.opensource.zalan.do/stups/ubuntu:latest
#==============================
# Locale and encoding settings
#==============================
# Note: LANGUAGE="${LANG_WHICH}_${LANG_WHERE}.${ENCODING}"
ENV LANG_WHICH="en" \
LANG_WHERE="US" \
LOCALE_TAG="en_US" \
@elgalu
elgalu / .irbrc
Last active January 29, 2018 16:33
IRB / Pry copy last result, a.k.a `_`, to your OSX / Linux / Windows clipboard using the 'clipboard' gem
require 'clipboard' #gem install clipboard
def cbcopy(value)
Clipboard.copy value unless value.empty?
flash_message = value.empty? ? "Sorry, nothing to copy" : "Copied to clipboard"
print "# #{flash_message}: "
puts %Q("#{value}")
end
# Copy last result to the Clipboard
@elgalu
elgalu / customMatchers.js
Last active August 6, 2017 04:08
Some Protractor - Jasmine 1.3.x custom matchers
//////////////////////////
// Some Custom Matchers //
//////////////////////////
"use strict";
// Usage:
// Add `require('./customMatchers.js');` in your onPrepare block or file
// Config
var specTimeoutMs = 10000; // 10 secs
@elgalu
elgalu / ...README.md
Created July 21, 2017 14:30 — forked from schlomo/...README.md
Demo for UI testing with selenium based on Zalenium, see http://blog.schlomo.schapiro.org/2017/07/web-ui-testing-made-easy-with-zalenium.html for details
$ ./gradlew fullAcceptanceTest
:fullAcceptanceTest
:nakadi:clean
:nakadi:compileJava
Note: /home/user/forks/nakadi/src/main/java/org/zalando/nakadi/config/JsonConfig.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:nakadi:compileGroovy UP-TO-DATE
:nakadi:processResources