Typescript codebase errors check
npx tsc –noEmit
npx tsc –noEmit
const exec = require(’child_process’).exec var yourExecCmd = ‘ls -ltr’ // Function to exec shell cmd with callback function execWithCallback() { this.execCommand = function(cmd, callback) { exec(cmd, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`) return } console.log(’stdout:’, stdout) console.log(’stderr:’, stderr) callback(stdout) }) } } var execWithCallback = new execWithCallback() execWithCallback.execCommand(yourExecCmd, […]
xs: Extra small devices (less than 600px) sm: Small devices (600px and up) md: Medium devices (900px and up) lg: Large devices (1200px and up) xl: Extra large devices (1536px and up) <Box sx={(theme) => ({ textAlign: ‘center’, [theme.breakpoints.up(’md’)]: { textAlign: ‘left’ }, })} > TEXT </Box> theme.breakpoints.up(‘md’) means @media (min-width: 900px) So, the above […]
const hostname = "www.someaddress.com" console.log(!!hostname.startsWith(’www.’) ? ‘matching’ : ‘not matching’)
Associative arrays in PHP = Javascript Objects written as name value pairs = Hash maps in Java
<script type="text/javascript"> … $parent = $(’#yourobject’).parent(); $child = $(’#yourobject’).children(’:first’); … </script>
<a id="my-favourite1"/ class="added"> <a id="my-favourite2"/ class="add"> <a id="my-favourite3"/ class="add"> <a id="my-favourite4"/ class="added"> <a id="my-favourite5"/ class="added"> <script type="text/javascript"> $(’a[id^=my-favourite]’).on(’click’, function (e) { console.log(’Clicked’); console.log(this.id); console.(this.id.removeClass(’added’).addClass(’add’)); } ); </script>
Avoid using “http://” or “https://” when loading the script in html, css or javascript. The correct example is this: <script type="text/javascript"> $.getScript("//maps.googleapis.com/maps/api/js?key=somekey"); </script>
<script type="text/javascript"> if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase()) && location.protocol==’http:’) { alert(’Using current position in chrome restricted under http protocol’) } else if (/msie/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is MSIE"); } else if (/firefox/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is Firefox"); } </script>