This file contains hidden or 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
| function sum (num1, num2) { | |
| return num1 + num2 | |
| } |
This file contains hidden or 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
| export async function addVehicle(userId, vehicle) { | |
| const data = await api.addVehicle(userId, vehicle, axios); | |
| return dispatch({type: types.ADD_VEHICLE, data: {vehicle: data.data.addVehicle}}); | |
| } | |
| export async function updateVehicle(vehicle, index) { | |
| const data = api.updateVehicle(vehicle, axios); | |
| return dispatch({type:types.UPDATE_VEHICLE, data: {vehicle: data.data.updateVehicle, index}}) | |
| } |
This file contains hidden or 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
| export async function addVehicle(userId, vehicle) { | |
| return api.addVehicle(userId, vehicle, axios).then(data => { | |
| if (!data.errors) { | |
| store.dispatch({ | |
| type: types.ADD_VEHICLE, | |
| vehicle: data.data.addVehicle | |
| }); | |
| return data; | |
| } | |
| return Promise.reject(data.errors); |
This file contains hidden or 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
| <?php | |
| class User { | |
| private $name; | |
| private $age; | |
| public function setName(string $name) { | |
| $this->name = $name; | |
| } | |
| public function setAge($age):void |
This file contains hidden or 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
| if (expresion) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| // which can be refactored to | |
| return expresion; |
This file contains hidden or 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
| function validateEmail(email) { | |
| // validate and return true or false | |
| } | |
| function isEmailValid(email) { | |
| // validate and return true or false | |
| } | |
| function emailIsValid(email) { | |
| // validate and return true or false |
This file contains hidden or 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
| <?php | |
| class WidgetList { | |
| public int numberOfWidgets () {...} | |
| } |
This file contains hidden or 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
| /*********************************************************** | |
| * Some fancy comments here * | |
| * * | |
| ***********************************************************/ |
This file contains hidden or 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
| export default { | |
| name: 'some-component', | |
| data () { | |
| return { | |
| name: 'sadick' | |
| } | |
| }, | |
| methods: { | |
| getUsername () { | |
| this.$store.dispatch('getUsernameFromAPI') |
This file contains hidden or 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
| //get all shops | |
| const shops = await this.$store.dispatch('get', { | |
| url: '/shops', | |
| params: { | |
| type: 'all' | |
| }, | |
| type: 'GET_SHOPS_SUCCESS' | |
| }) | |
| // use your response if you need to |