Posts

Showing posts with the label JS

Compress ES6 On Intellij IDEA

Image
Install terser locally or globally npm i terser Open IDEA Settings/Preferences ( CTRL+ALT+S ) click File Watchers under Tools Click + Select Custom Program: select path terser bin OR type terser only if you installed terser globally Arguments: $FileDir$\$FileName$ -o $FileDir$\$FileNameWithoutExtension$.min.js -c -m --ie8 change \ to / if you using LINUX change parameter terser from -c - ie8 as you want do Output Path To Refresh: $FileNameWithoutExtension$.min.js See Screenshot For Configuration

Fix Error NodeJS Windows Visual Studio

Image
Install Microsoft Visual Studio Code 2019 Install Module C++ Type below codes to your terminal (administrator) npm i -g --production windows-build-tools npm config set msvs_version 2019 --global npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"

Perbedaan typescript dan javascript secara rinci

Image
Typescript atau Javascript? Apa saja perbedaan typescript dan javascript? Secara Harfiah: Typescript lebih strict / lebih detail dan harus mematuhi peraturan seperti typedata (variable, class, interface, dll), hampir sama seperti KOTLIN untuk segi peraturan. Javascript itu bebas, tidak akan memberikan error jika kode / variable / syntax diatasnya sudah dideklarasikan terkecuali class dan interface, javascript pun tidak memperdulikan mau type macam apa di variable yang penting logic yg ditentukan itu sama atau akan dikembalikan ke bentuk 'undefined'. Compiler: Javascript tidak membutuhkan compiler untuk menjalankannya. Sedangkan typescript membutuhkan compiler sebelum di run. Compatibility: Typescript bisa menciptakan javascript dalam macam-macam type browser hanya dengan 1x tulis kode. Javascript tidak dapat membuat semua syntax nya compatible dengan semua browser jika tidak menentukan Condition yang tepat. Invertible: Typescript dapat melakukan apa yg dilakukan java

Fix React Native error Invalid regular expression: /(.*\\__fixtures__

If you Got this issue today on windows, but don't need to downgrade node, just as discussed on stackoverflow just need to change some hashes on your project: node_modules\react-native\packager\blacklist.js var sharedBlacklist = [ /node_modules[/\\]react[/\\]dist[/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ]; Change to: var sharedBlacklist = [ /node_modules[\/\\]react[\/\\]dist[\/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ];

Load CSS Asynchronously

Load CSS Asynchronously Usage: loadCSS('//CSS_URL'); loadCSS('//raw.githack.com/PrismJS/prism-themes/master/themes/prism-vs.css');

Simple PrismJS

Simple PrismJS Syntax Highlighter <pre> <code> (Not Single) Usage: <pre><code>code block</code></pre> <h3>Welcome to the real-time HTML editor!</h3> <p>Type HTML in the textarea above, and it will magically appear in the frame below.</p> Only <code> Usage: <code>code block</code> <h3>Welcome to the real-time HTML editor!</h3> <p>Type HTML in the textarea above, and it will magically appear in the frame below.</p> Pre (Single Pretext) <h3>Welcome to the real-time HTML editor!</h3> <p>Type HTML in the textarea above, and it will magically appear in the frame below.</p> Pre (Single Pretext) + lang="js" Usage: <pre lang="js">code block</pre> if (window.addEventListener) { window.addEventListener("load", downloadJSAtOnload, false); } else if (window.attachEvent) { window.attach

[JS] How to delay ajax one by one in loop

Image
Bahasa indonesia: Bagaimana eksekusi ajax satu per satu di Loop <div id="demo"></div> <script> /** * Define global variable * @var {int} indexLoop global loop indexer * @var {int} lastLoop global last iteration for global loop indexer from loop initializer * @var {array} queueLoop global array to be processed from ajax * @var {array} arrayLoop define array to be proccesed */ var indexLoop = 0, lastLoop = 0, queueLoop = [], arrayLoop = ['apple', 'melon', 'watermelon', 'grapes']; for (var i = 0; i < arrayLoop.length; i++) { queueLoop.push(arrayLoop[i]); if (i == arrayLoop.length - 1) { lastLoop = i + 1; ajaxLoop(function () { var b = document.createElement('b'); b.innerHTML = 'Processing all item ' + indexLoop + ' of ' + lastLoop + ' succedeed<br/>'; document.getElementById('demo').appendChild(b); }

Javascript Debug Protector

Image
How to protect javascript from developer tools ? here the answer. put this code into your page or template before closing body ( </body> ) <script src="https://cdn.jsdelivr.net/gh/dimaslanjaka/Web-Manajemen@master/js/protector.js" async></script> This script functions to hide the output from console.log, console.error, console.warning, and so on. and will also notify visitors that the site being opened is in a time suspension, because the visitor is opening the developer tools in his browser. This article about : protect javascript from debugging hide javascript console from developer tools protect site from debugging