Skip to content

Instantly share code, notes, and snippets.

View bcaudan's full-sized avatar

Bastien Caudan bcaudan

View GitHub Profile
@bcaudan
bcaudan / display_action_name.js
Created April 23, 2021 09:03
display_action_name.js
(function() {
function getActionNameFromElement(element) {
// Proceed to get the action name in two steps:
// * first, get the name programmatically, explicitly defined by the user.
// * then, use strategies that are known to return good results. Those strategies will be used on
// the element and a few parents, but it's likely that they won't succeed at all.
// * if no name is found this way, use strategies returning less accurate names as a fallback.
// Those are much likely to succeed.
return (getActionNameFromElementProgrammatically(element) ||
getActionNameFromElementForStrategies(element, priorityStrategies) ||
@bcaudan
bcaudan / detect-overriden-properties.js
Last active July 27, 2018 13:25
detect window properties overriden in the current page
(function () {
const iframe = document.createElement('iframe');
document.head.appendChild(iframe);
const cleanWindow = iframe.contentWindow;
function detect(debug) {
const filteredProperties = Object.getOwnPropertyNames(window)
.filter(isNotCommonProperty)
.filter(isNotBlacklistedProperty)
.filter(hasObjectType(window))
@bcaudan
bcaudan / instructions.md
Last active August 10, 2016 16:18
cs-env-osx Docker Toolbox -> Docker for Mac
  • Arrêtez votre docker-machine :

      docker-machine stop cs-env
    
  • Démarrez un nouveau terminal et assurez vous qu'aucune variable DOCKER_* n'est présente (enlevez les de votre bashrc sinon)

      env | grep DOCKER
    
  • Ajoutez à votre bashrc :

@bcaudan
bcaudan / docker.rb
Last active August 10, 2016 13:07 — forked from jluckyiv/docker.rb
Docker for Mac cask
# Adapted from https://github.com/caskroom/homebrew-cask/pull/20512
cask 'docker' do
version :latest
sha256 :no_check
url 'https://download.docker.com/mac/stable/Docker.dmg'
name 'Docker'
homepage 'https://docs.docker.com/docker-for-mac/'
license :gratis
<html>
<head>
<script type="text/javascript">
Math.random(); // jquery
if (Math.random() > 0.1) {
// excluded
log('');
} else {
// choose version
var totalPercentage = 100;
@bcaudan
bcaudan / git-prv
Last active August 29, 2015 14:19
Push and send commits to Review Board. Install: add it in your path. Usage: git prv
#!/usr/bin/env bash
readonly CURRENT_BRANCH=$(git symbolic-ref HEAD | sed -e "s/^refs\/heads\///")
readonly COMMIT_REFS=($(git rev-list origin/$CURRENT_BRANCH..$CURRENT_BRANCH))
readonly GROUPS="Frontend"
post_reviews() {
for (( idx=${#COMMIT_REFS[@]}-1 ; idx>=0 ; idx-- )) ; do
rbt post -p --target-groups=${GROUPS} ${COMMIT_REFS[idx]}
done
}
<div id="formule">
<a href="" id="reco">pourquoi nous vous recomandons cette offre ?</a>
<div class="formule">
<div class="formtop">
</div>
<div class="checker">
<div class="gartype"><a href="">Responsabilité civile</a></div>
<div class="gartype"><a href="">Défense pénale et recours</a></div>
<div class="gartype"><a href="">Protection du conducteur</a></div>
<div class="gartype"><a href="">Catastrophe naturelle</a></div>
@bcaudan
bcaudan / check-js-test
Last active January 2, 2016 07:09
Check test files for "ddescribe", "iit" or "pause()". Usage: check-js-test src/test/javascript/unit src/test/javascript/e2e
#!/bin/bash
function hasAny() {
sep="\|"
regex="$( printf "${sep}%s" "$@" )"
regex="${regex:${#sep}}"
grep -nri --color=always "$regex" *
}
SEARCH="hasAny 'ddescribe' 'iit' 'pause()'"
@bcaudan
bcaudan / git-build
Last active January 1, 2016 23:49 — forked from dgageot/git-build
#!/bin/bash
function alert_user {
echo "${1}"
which -s growlnotify && growlnotify `basename $0` -m "${1}"
}
function exit_ko {
alert_user "${1}"; exit 1
}