This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import currency from 'currency.js'; | |
// Library docs: https://currency.js.org/ | |
// We create a custom constructor with custom config here | |
export function customCurrency(value, options) { | |
if (value === null || value === undefined) return value; // I don't like that it returns 0.00 | |
if (!(this instanceof customCurrency)) { // this enables calling the function without 'new' | |
return new customCurrency(value, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
/** | |
* Deep diff between two objects - i.e. an object with the new value of new & changed fields. | |
* Removed fields will be set as undefined on the result. | |
* Only plain objects will be deeply compared (@see _.isPlainObject) | |
* | |
* Inspired by: https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-2565071 | |
* This fork: https://gist.github.com/TeNNoX/5125ab5770ba287012316dd62231b764/ | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ssh_deploy_template: &ssh_deploy_template | |
# TEMPLATE - see https://docs.gitlab.com/ee/ci/yaml/README.html#anchors | |
# ... | |
# Here's the magic to get the code from the GitLab variable into a bash variable and then even executed on an SSH session | |
script: | |
# Put gitlab variable into shell variable to improve quote handling | |
- CMD=$SCRIPT_CMD | |
# Print for debugging | |
- echo -e "Executing:\n$CMD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
################################################# | |
if [[ $# -ne 1 ]]; then | |
echo "This script:" | |
echo "1. resets and initializes the DB on the specified commit/branch" | |
echo "2. goes back to the codebase you ran this script from" | |
echo "3. runs the app again" | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testResourceLoad(ResourceLoader resourceLoader) { | |
System.out.println("resourceLoader k:" + resourceLoader.getResource("keycloak.json").exists()); | |
System.out.println("resourceLoader /k:" + resourceLoader.getResource("/keycloak.json").exists()); | |
System.out.println("resourceLoader c:k:" + resourceLoader.getResource("classpath:keycloak.json").exists()); // dev | |
System.out.println("resourceLoader c:/k:" + resourceLoader.getResource("classpath:/keycloak.json").exists()); // dev | |
System.out.println("resourceLoader f:k:" + resourceLoader.getResource("file:keycloak.json").exists()); // jar | |
System.out.println("resourceLoader f:/k:" + resourceLoader.getResource("file:/keycloak.json").exists()); | |
System.out.println("getClass() k:" + getClass().getResource("keycloak.json")); | |
System.out.println("getClass() /k:" + getClass().getResource("/keycloak.json")); // dev | |
System.out.println("getClass() c:k:" + getClass().getResource("classpath:keycloak.json")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ! install xdotool first - it is needed to check if the terminal is in foreground (or disable that if you don't want) | |
# then append this to ~/.config/fish/config.fish (create it if not existent) | |
function alert_cmd_done --on-event fish_postexec | |
set status_code $status # save for later | |
set active_window (ps -p (xdotool getwindowpid (xdotool getactivewindow)) -o comm=) # get the process name of the currently active window | |
if status --is-interactive # Check for interactive session (keyboard attached) | |
if [ $active_window != "pantheon-termin" -a \ | |
$CMD_DURATION -a \ | |
$CMD_DURATION -gt (math "1000 * 5") ] # in background, after a job longer than 5 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Execute this on the phpwcms files page when all wanted folders are opened | |
* (all visible download buttons will be added to the array) | |
**/ | |
var save_buttons = $('img[src="img/button/download_disc.gif"]'); | |
function isFolder($tr) { | |
return $tr.attr('bgcolor') == '#EBF2F4'; | |
} |
NewerOlder