Node Update Command Npm
node update command npm npm install -g update-node npm update syntax npm update -g <package_name> Source: docs.npmjs.com npm update syntax npm outdated Source: docs.npmjs.com
node update command npm npm install -g update-node npm update syntax npm update -g <package_name> Source: docs.npmjs.com npm update syntax npm outdated Source: docs.npmjs.com
how to uncheck a checkbox in jquery $(“#myCheckBox”).prop(“checked”, false); Source: www.tutorialrepublic.com jquery set checkbox checked unchecked //jQuery 1.6+ use $(‘.checkbox’).prop(‘checked’, true); //false for uncheck //jQuery 1.5.x and below use $(‘.checkbox’).attr(‘checked’, true); //false for uncheck jquery uncheck checkbox $(‘#myCheckbox’).prop(‘checked’, true); // Checks it $(‘#myCheckbox’).prop(‘checked’, false); // Unchecks it get unchecked checkbox jquery if ($(“#check_box_id”).is(‘:checked’)) { alert(“checked”); }else{ … Read more
get page url without params in javascript window.location.href.split(‘?’)[0];
jquery find if select option exists $(“#yourSelect option[value=’yourValue’]”).length > 0;
yarn \angular cli yarn global add @angular/cli
Laravel Migration Change to Make a Column Nullable composer require doctrine/dbal Source: stackoverflow.com laravel migration make column nullable Schema::table(‘users’, function($table) { $table->string(‘name’, 50)->nullable()->change(); }); This is the correct syntax to revert the migration: $table->integer(‘user_id’)->unsigned()->nullable(false)->change(); Source: stackoverflow.com laravel migration table column nullable $table->string(/*column name*/, /*size*/)->nullable(true);
Changing columns for table “users” requires Doctrine DBAL. Please install the doctrine/dbal package. composer require doctrine/dbal Source: stackoverflow.com Changing columns for table “” requires Doctrine DBAL. Solution: $ composer remove doctrine/dbal $ composer require doctrine/dbal:2.* I hope it helps someone, good luck 😉
doctrine/dbal laravel install composer require doctrine/dbal Source: stackoverflow.com doctrine/dbal package composer require doctrine/dbal
Class ‘Doctrine\DBAL\Driver\PDOMySql\Driver’ not found composer require doctrine/dbal Source: stackoverflow.com Class ‘Doctrine\DBAL\Driver\PDOPgSql\Driver’ not found # For Laravel 6x/7x: composer require doctrine/dbal:”^2.0″ # For Laravel >= 8x: composer require doctrine/dbal Source: stackoverflow.com Symfony\Component\Debug\Exception\FatalThrowableError : Class ‘Doctrine\DBAL\Driver\PDOSqlite\Driver’ not found Symfony\Component\Debug\Exception\FatalThrowableError : Class ‘Doctrine\DBAL\Driver\PDOSqlite\Driver’ not found
chart js remove grid var options = { scales: { xAxes: [{ gridLines: { display:false } }], yAxes: [{ gridLines: { display:false } }] } } Source: stackoverflow.com chart js remove grid options: { scales: { xAxes: [{ gridLines: { drawOnChartArea: false } }] } }
Consider using ‘–resolveJsonModule add “resolveJsonModule”: true key in tsconfig.json { “compilerOptions”: { “target”: “es2015”, “module”: “commonjs”, “strict”: true, “moduleResolution”: “node”, “resolveJsonModule”: true } } Cannot find module ‘./data.json’. Consider using ‘–resolveJsonModule’ to import module with ‘.json’ extension add to tsconfig.json { … “resolveJsonModule”: true } } Source: mariusschulz.com –resolveJsonModule declare module “*.json” { const value: any; … Read more
remove non alphanumeric characters javascript input.replace(/\W/g, ”) //doesnt include underscores input.replace(/[^0-9a-z]/gi, ”) //removes underscores too replace non alphanumeric javascript text.replace(/[\W_]+/g,” “);
js random hex color ‘#’+Math.floor(Math.random()*16777215).toString(16); Source: www.paulirish.com javascript random color generator function generateRandomColor() { var letters = ‘0123456789ABCDEF’; var color = ‘#’; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } var randomColor=generateRandomColor();//”#F10531″ function to generate random color in javascript function random(number){ return Math.floor(Math.random()*number);; } function … Read more
days array fullName [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”]; shortName [“Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, “Sun”]; days array javascript [ “Sunday”,”Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”];
jquery ready wordpress jQuery(document).ready(function($){ // Code goes here });
jquery set attribute readonly // jQuery < 1.9 $(‘#id’).attr(‘readonly’, true); // jQuery >= 1.9 $(‘#id’).prop(‘readonly’, true); add readonly attribute jquery $(input).attr(‘readonly’, true); add readonly attribute jquery $(‘#inputId’).attr(‘readonly’, true); Source: nullorempty.org
javascript regex email function validateEmail (emailAdress) { let regexEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if (emailAdress.match(regexEmail)) { return true; } else { return false; } } let emailAdress = “test@gmail.com”; console.log(validateEmail(emailAdress)); regex validate email function validateEmail(email) { const re = /^(([^<>()\[\]\\.,;:\s@”]+(\.[^<>()\[\]\\.,;:\s@”]+)*)|(“.+”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); js email regex function isValidEmail(email) { const re = /^(([^<>()\[\]\\.,;:\s@”]+(\.[^<>()\[\]\\.,;:\s@”]+)*)|(“.+”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); how to validate … Read more
remove underline from link i react <Link to=”/” style={{textDecoration:”none”}} /> remove underline from hyperlink react You can add style={{ textDecoration: ‘none’ }}
alpine js cdn <script src=”https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.2/dist/alpine.min.js” defer></script> alpinejs cdn <script defer src=”https://unpkg.com/alpinejs@3.4.2/dist/cdn.min.js”></script> Source: alpinejs.dev alpine js cdn <html> <head> … <script defer src=”https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js”></script> </head> … </html> Source: alpinejs.dev alpine js <div x-data=”{ open: false }”> <button @click=”open = true”>Open Dropdown</button> <ul x-show=”open” @click.away=”open = false” > Dropdown Body </ul> </div> Source: github.com
can we import jquery library from developer tools var script = document.createElement(‘script’);script.src = “https://code.jquery.com/jquery-3.4.1.min.js”;document.getElementsByTagName(‘head’)[0].appendChild(script); Source: stackoverflow.com
create an array from 1 to n javascript Array.from(Array(10).keys()) //=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] […Array(10).keys()] //=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Array.from({length: 10}, (_, i) => i + 1) //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Source: stackoverflow.com javascript fill array … Read more
get start of day javascript var start = new Date(); start.setHours(0,0,0,0); var end = new Date(); end.setHours(23,59,59,999); alert( start.toUTCString() + ‘:’ + end.toUTCString() );
window load jquery $(window).on(‘load’, function() { console.log(‘All assets are loaded’) }) Source: stackoverflow.com call a function on load jquery $(document).ready(function () { // Function code here. }); Source: stackoverflow.com
require jquery tampermonkey // @require http://code.jquery.com/jquery-3.4.1.min.js Source: stackoverflow.com
jquery disable input //jQuery 1.6+ use: $(“#inputID”).prop(‘disabled’, true); //disable $(“#inputID”).prop(‘disabled’, false); //enable //jQuery 1.5 and below use: $(“#inputID”).attr(‘disabled’,’disabled’); //disable $(“#inputID”).removeAttr(‘disabled’); //enable disable input field with jquery // Disable #x $( “#x” ).prop( “disabled”, true ); // Enable #x $( “#x” ).prop( “disabled”, false ); jquery check input is disable if($(‘textbox’).is(‘:disabled’)){ //textbox is disabled } Source: stackoverflow.com … Read more
prop disabled //jQuery 1.6+ use: $(“#inputID”).prop(‘disabled’, true); //disable $(“#inputID”).prop(‘disabled’, false); //enable //jQuery 1.5 and below use: $(“#inputID”).attr(‘disabled’,’disabled’); //disable $(“#inputID”).removeAttr(‘disabled’); //enable disable input field with jquery // Disable #x $( “#x” ).prop( “disabled”, true ); // Enable #x $( “#x” ).prop( “disabled”, false ); enable input jquery $(‘input’).prop(‘disabled’, false); Source: stackoverflow.com
jQuery disable and enable input //jQuery 1.6+ use: $(“#inputID”).prop(‘disabled’, true); //disable $(“#inputID”).prop(‘disabled’, false); //enable //jQuery 1.5 and below use: $(“#inputID”).attr(‘disabled’,’disabled’); //disable $(“#inputID”).removeAttr(‘disabled’); //enable
javascript sleep for 1 second function delay(time) { return new Promise(resolve => setTimeout(resolve, time)); } delay(1000).then(() => console.log(‘ran after 1 second1 passed’)); Source: masteringjs.io js sleep 1 second await new Promise(resolve => setTimeout(resolve, milliseconds)) Source: www.codegrepper.com javascript sleep 1 second async function test() { console.log(‘start timer’); await new Promise(resolve => setTimeout(resolve, 1000)); console.log(‘after 1 second’); } test(); … Read more
javascript wait 1 second setTimeout(function(){ console.log(“Ready”) }, 1000); javascript wait 1 second setTimeout(() => {console.log(‘1 second finished!’)}, 1000);
js 1 second delay function delay(time) { return new Promise(resolve => setTimeout(resolve, time)); } delay(1000).then(() => console.log(‘ran after 1 second1 passed’)); Source: masteringjs.io javascript wait 1 second setTimeout(function(){ console.log(“Ready”) }, 1000); javascript wait 1 second setTimeout(() => {console.log(‘1 second finished!’)}, 1000);