Skip to content

Instantly share code, notes, and snippets.

View petitchevalroux's full-sized avatar

Patrick Poulain petitchevalroux

View GitHub Profile
@petitchevalroux
petitchevalroux / node-modules-binaries-to-path.sh
Last active November 13, 2017 10:20
Adding locally installed node.js binaries to $PATH
#!/bin/bash
# To add locally installed node.js binaries to $PATH
# Add the following code to your ~/.profile|~/.bash_profile|...
# If npm is available
if hash npm 2>/dev/null; then
# previously appended string
_NMB_PREVIOUS=""
_PREVIOUS_PATH=""
function addNodeModulesBinariesToPath() {
@petitchevalroux
petitchevalroux / ReferenceInputRequired.js
Created July 25, 2017 15:38
Admin-on-rest : ReferenceInputRequired on create
import {ReferenceInput} from 'admin-on-rest';
export class ReferenceInputRequired extends ReferenceInput {
};
ReferenceInputRequired.defaultProps = Object.assign({}, ReferenceInput.defaultProps);
ReferenceInputRequired.defaultProps.allowEmpty = true;
ReferenceInputRequired.defaultProps.validate = (value, _, props) => {
if (!value) {
return [props.translate("aor.validation.required")];
@petitchevalroux
petitchevalroux / script.sh
Created September 9, 2017 08:20
Redis delete keys matching a patterns
redis-cli --no-raw keys "exd:*" | perl -pe 's/^.*?[0-9]+\)/del/g' | redis-cli
@petitchevalroux
petitchevalroux / create-pull-request.sh
Created October 11, 2017 13:45
create pull request on master
#!/bin/bash
function errorMessage {
printf '%s\n' "Error: $1" >&2
}
function message {
printf '%s\n' "$1"
}