Posts

[JS] Check select2 jquery plugin loaded or not

Image
Read How to async defer CSS JS perfectly if (jQuery.fn.select2) { //jquery select2 loaded or not false or not undefined => return array jQuery.fn.select2.defaults.set( "theme", "bootstrap" ); //then select themes } Example: How to change select2 jQuery plugin using jQuery.val() $('#mySelect2').val('US'); // Change the value or make some change to the internal state if (jQuery.fn.select2) { $('#mySelect2').trigger('change.select2'); // Notify only Select2 of changes }

Create Folder Recursive PHP

Image
How to automatically create folder if not exists on spesific PATH Bagaimana cara membuat folder secara rekursif bila tidak ada pada spesifik PATH <?php // define document root first define document root dahulu define('APP', $_SERVER['DOCUMENT_ROOT'], true); // [func] path extraction and creation function _folder_($d){ $d = str_replace(APP, '', rtrim($d, '/')); $explode = explode('/', rtrim($d,'/')); $explode = array_filter($explode); $ready = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? '' : '/'); foreach ($explode as $x) { $ready = rtrim($ready,'/'); $ready .= '/'.$x; $status = file_exists(APP.$ready); if ($status === false){ mdir(APP.$ready); } } return $d; } // [func] create folder permission 777 function mdir($x) { $oldmask = umask(0); mkdir($x, 0777); umask($oldmask); } // Usage Penggunaan $folder_target = ?

Cygwin In Context Menus

Image
How might I make a Cygwin alternate way that will open Cygwin at a particular envelope? This would hinder composing cd disc/cygdrive/c/Users/Tom/Desktop/ each time I dispatch Cygwin. When you introduce Cygwin (or in the event that you've just introduced it, download it again and begin setup again to run an update), ensure that you select the chere bundle under the "Shells" classification. After Cygwin is launched, open Cygwin terminal and type command: chere -i -t mintty -s bash Presently you bought to have "Bash Prompt Here" in the Windows right-click setting menu. ( mintty is Cygwin's default terminal. If you don't choose it with the -t option, your "Bash Prompt Here" will use the same terminal as the Windows Command Prompt, which prevents horizontal resizing.)