Skip to content

Instantly share code, notes, and snippets.

View ViBiOh's full-sized avatar
🦦

Vincent Boutour ViBiOh

🦦
View GitHub Profile
@ViBiOh
ViBiOh / bootstrap
Last active February 22, 2022 17:05
Dotfiles
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
main() {
local INSTALL_PATH="${HOME}/code"
local GITHUB_USER="ViBiOh"
local DOTFILES_NAME="dotfiles"
local DOTFILES_BRANCH="main"
local ARCHIVE_FILENAME="${INSTALL_PATH}/dotfiles.zip"
@ViBiOh
ViBiOh / git.sh
Last active January 15, 2024 19:26
Git sync
#!/usr/bin/env bash
git_is_inside() {
git rev-parse --is-inside-work-tree 2>&1
}
git_root() {
if [[ $(git_is_inside) != "true" ]]; then
pwd
return
@ViBiOh
ViBiOh / pre-commit
Last active May 2, 2018 20:18
GitHook
#!/usr/bin/env bash
diffInitial=`git diff --name-only --diff-filter=ACMR`
BLUE='\033[0;34m'
RED='\033[0;31m'
RESET='\033[0m'
package=`git diff --cached --name-only --diff-filter=ACMR | grep -E "package.json$"`
js=`git diff --cached --name-only --diff-filter=ACMR | grep -E "jsx?$"`
@ViBiOh
ViBiOh / parseString.js
Last active April 29, 2016 15:21
Extract strings from a javascript source file
function isFunction(potentialFunction) {
return potentialFunction && Object.prototype.toString.call(potentialFunction) === '[object Function]';
}
function stringsReplace(str, callback) {
if (isFunction(callback)) {
str.replace(/(["'`])((?:(?=(\\?))\3.)*?)\1/gmi, (all, quote, value) => callback(value));
}
return str.replace(mustacheRegex, callback);
}
@ViBiOh
ViBiOh / uniqueGmail.js
Last active April 29, 2016 15:13
Clean a Gmail address to its real identifier
email.trim().replace(/^(.*?)(?:\+.*?)?(@gmail\.com)$/gi, '$1$2').replace(/\.(?!com$)/g, '');