Skip to content

Instantly share code, notes, and snippets.

View jsrois's full-sized avatar

Javier Sánchez Rois jsrois

View GitHub Profile
#=Navigating=
visit('/projects')
visit(post_comments_path(post))
#=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click_on('Button Value')
@jsrois
jsrois / copyFiles.pri
Created July 29, 2015 10:27
function used to copy target files to an specific location
defineTest(copyFiles) {
files = $$1 # first argument is a list of files
DDIR = $$2 # second is a destination directory
# first we create the destination dir
QMAKE_POST_LINK += $$QMAKE_MKDIR $$quote($$DDIR) $$escape_expand(\\n\\t)
# second we copy 'em files
for(FILE, files) {
# Replace slashes in paths with backslashes for Windows
#!/bin/sh
set -e
set -x
temp_dir=/tmp/install_consolas_and_solarized
mkdir -p $temp_dir
sudo apt-get install cabextract -y
pushd $temp_dir
echo "installing consolas"
wget http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe
cabextract -L -F ppviewer.cab PowerPointViewer.exe
#!/bin/bash
domain_name=example.com
date_info=$(date +%s)
output_file=add_users_$date_info.groovy
echo "// Automatically generated groovy script -- $date_info" > $output_file
while [[ $# > 0 ]]
do
echo "generating user/password for [$1]..."
pass=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
user=$1
@jsrois
jsrois / install_caffe_sunai_uoc.sh
Last active August 31, 2016 17:06
Installs Caffe in the Sunai@UOC server (May2016)
git clone https://github.com/BVLC/caffe.git
mkdir caffe/build
cd caffe/build
# these two hacks are required
export LC_ALL=es_ES.UTF-8 # this locale variable is unset
sed -i '29iset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")' ../CMakeLists.txt
cmake -DBUILD_matlab=ON .. # matlab is disabled by default
make all # this takes a while
make runtest # all green
cd -
#!/bin/bash
if [ "$#" -ge 1 ]; then
first_commit=$1
else
first_commit=HEAD^
echo "Analyzing last commit only"
fi
for commit in $(git log $first_commit..HEAD --pretty=format:"%h") ; do
@jsrois
jsrois / polymorphism-plus-unique-ptr.cpp
Created April 3, 2017 12:17
How can we create an std::vector for objects implementing an interface?
#include <iostream>
#include <vector>
#include <memory>
#include <sstream>
using namespace std;
struct RuleImpl {
virtual string serialize() const = 0;
};
@jsrois
jsrois / .gitconfig
Created April 20, 2017 13:25
git configuration
[user]
name = Javier Sánchez Rois
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; gedit `f`"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add `f`"
@jsrois
jsrois / on_call_with_lambdas.cpp
Created May 6, 2017 08:31
GoogleMock adding a default action to increment a counter using lambdas.
#include <gmock/gmock.h>
using namespace testing;
struct SomeStruct {
virtual void apply() {
// do nothing
}
};
El objetivo es escribir entre todas la letra de Master of Puppets en un mismo repositorio y en un mismo archivo.
- Cada pareja sólo puede contribuír con TRES estrofas como máximo.
- Debéis poneros de acuerdo primero en cómo lo vais a hacer.
End of passion play, crumbling away
I’m your source of self-destruction
Veins that pump with fear, sucking darkest clear
Leading on your death’s construction