adsense

Friday, March 29, 2024

Append JavaScript to html body

      

Following JavaScript code will append an external JavaScript file to the document body. This can be used as guide to load a JavaScript file on the fly.

<script type="text/javascript">

var newScript = document.createElement('script');

newScript.type = 'text/javascript';

 newScript.async = true;

 newScript.src = 'https://somedomain.com/JsFileName.js'; 

document.getElementsByTagName("body")[0].appendChild(newScript);

 </script>

cheers,

Samitha

Sunday, March 3, 2024

Auto Generate .gitignore file

 This is a configuration file that tells Git what to ignore when committing changes to Git based repositories (the ones in GitHub).

 The .gitignore file controls what  files to ignore  when committing changes to Git repositories. The good new is is there is a tool called gitignore.io. This tool will generate such files for us.

I like this as it allows to type programming languages/platforms and generates the file for us

 Cheers,

Samitha