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
| //Hoisting | |
| y = 80; // Assign 5 to x | |
| x=y+5 // sum up 5 with the value of y | |
| var y; // Declare y | |
| //JavaScript only hoists declarations, not initializations. | |
| var name = "Abel"; |
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
| public class Dependant | |
| { | |
| public string id_number { get; set; } | |
| public string relationship { get; set; } | |
| public string last_name { get; set; } | |
| public string first_name { get; set; } | |
| public string gender { get; set; } | |
| public string birthdate { get; set; } | |
| public string photo { get; set; } | |
| } |
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
| SELECT * | |
| FROM ItemsEntity where item_id=1 | |
| FOR JSON AUTO |
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
| use Illuminate\Support\Facades\Schema; | |
| public function boot() | |
| { | |
| Schema::defaultStringLength(191); | |
| } |
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 loop(arr) { | |
| // i IS NOT known here | |
| // j IS NOT known here | |
| for( var i = 0; i < arr.length; i++ ) { | |
| // i IS known here | |
| } | |
| // i IS known here | |
| // j IS NOT known 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
| import React, { Component } from 'react'; | |
| import loading_icon from '../images/ellipsis.gif'; | |
| export default class BlankState extends Component { | |
| constructor(props){ | |
| super(props); | |
| let { data = [], dataName = 'Info', isDataLoading, customMessage } = this.props; |
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
| import validator from 'validator'; | |
| class FormValidator{ | |
| constructor(validations) { | |
| // validations is an array of validation rules specific to a form | |
| this.validations = validations; | |
| } | |
| validate(state){ | |
| // start out assuming valid | |
| let validation = this.valid(); |
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
| axios.get(geocodeURL).then((response)=>{ | |
| if(response.data.status==='ZERO_RESULTS'){ | |
| throw new Error('Unable to find that address!'); | |
| } | |
| const lat=response.data.results[0].geometry.location.lat; | |
| const lng=response.data.results[0].geometry.location.lng; | |
| const weatherURL=`https://api.darksky.net/forecast/3708bcb6e2a477e7fb94de8fd3ecdfab/${lat},${lng}`; |
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
| //async promise with user input | |
| const asyncAdd=(a,b)=>{ | |
| return new Promise((resolve,reject)=>{ | |
| setTimeout(()=>{ | |
| if(typeof a=== 'number' && typeof b==='number'){ | |
| resolve(a+b); | |
| }else { | |
| reject('Arguments must be numbers'); | |
| } | |
| },1500) |
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
| const selectedGoods = quote.selected_goods; | |
| if(this.goodsValidator.allValid()){ | |
| this.goodsValidator.hideMessages(); | |
| selectedGoods.push(selectedGood); | |
| }else { | |
| this.goodsValidator.showMessages(); | |
| // rerender to show messages for the first time | |
| this.forceUpdate(); | |
| } |