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
# using ruby gem "i18n-tasks" | |
locale_changed=$(git diff --name-only --staged | grep "locales/en.yml") | |
if [ -n "$locale_changed" ]; then | |
echo "Locale changed, running i18n-task normalize" | |
i18n-tasks normalize | |
git add config/locales/ | |
echo "Done" | |
fi |
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 React from "react"; | |
import Select from "react-select"; | |
class CustomSelect extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { menuIsOpen: false }; | |
} | |
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
// Using lodash for _.forEach | |
function transformToFormData(data, formData=(new FormData), parentKey=null) { | |
_.forEach(data, (value, key) => { | |
if (value === null) return; // else "null" will be added | |
let formattedKey = _.isEmpty(parentKey) ? key : `${parentKey}[${key}]`; | |
if (value instanceof File) { | |
formData.set(formattedKey, value); | |
} else if (value instanceof Array){ |