- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
| If it's distribution, let the documentation exists and point your vhost entry to demo folder. | |
| make a .gitignore file from example.gitignore file | |
| check if settings file, files folder and other unnecesary files like *~ are excluded. | |
| do got init to initiliaze a git repo | |
| do git status to see list of files. | |
| add git config username and email | |
| add git remote origin points to push your repo | |
| do commit and push it. | |
| Hola! and you are done. |
| # Split MYSQL dump file | |
| zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }' | |
| # Parallel import using GNU Parallel http://www.gnu.org/software/parallel/ | |
| ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_name "<" | |
| # Taken from :https://www.drupal.org/developing/api/8/configuration/simple | |
| //Immutable Config (Read Only) | |
| $config = \Drupal::config('system.performance'); | |
| //Mutable Config (Read / Write) | |
| $config = \Drupal::service('config.factory')->getEditable('system.performance'); | |
| // To read contents | |
| $message = \Drupal::config('system.maintenance')->get('message'); //gets only particular key value, or array if data in next levels |
| # Stop running myslq server | |
| sudo /etc/init.d/mysql stop | |
| #Restart mysql server in safe mode with no grant table(no security) | |
| sudo mysqld_safe --skip-grant-tables & | |
| #Login to muysql as root | |
| mysql -uroot | |
| #Change to mysql database |
| ============================================ | |
| Using drush to get a list of enabled modules | |
| ============================================ | |
| If you just wanted to make a list of all the modules which are installed in your instance. Don't waste time, be smart write a command using drush. - See more at: http://drupaltonight.com/drupal-articles/using-drush-get-list-enabled-modules#sthash.b10DQqN5.dpuf | |
| List all modules and themes : | |
| drush pm-list | |
| List only modules : |
| // Get all the elements in the DOM with ajax enabled | |
| for (var ajax_element in Drupal.ajax) { | |
| if (typeof Drupal.ajax[ajax_element] !== 'undefined') { | |
| // Drupal.ajax[ajax_elements].ajaxing = false; | |
| // Get the actual jquery object for the submit button | |
| var $ajax_el_obj = jQuery(Drupal.ajax[ajax_element].element); | |
| // Check if it's reqd. button and then call beforesubmit for that |
| # For starting xdman | |
| java -jar xdman.jar | |
| #for editing hosts file | |
| sudo gedit /etc/hosts | |
| #For wget | |
| wget http://file_url | |
| #For resuming the previously interupted file download | |
| wget -c http://file_url |
| function trackLink(obj, name) { | |
| var s=s_gi(s_account); | |
| s.linkTrackVars='prop40'; | |
| s.prop40 = "Custom tracking text"; | |
| s.tl(obj,'o',s.prop40); | |
| s.prop40 = ""; | |
| s.linkTrackVars='None'; | |
| s.linkTrackEvents='None'; |
| /* | |
| * Function to sanitize the file name for url and file name safe. | |
| * | |
| * @param string $filename | |
| * The unsafe filename is taken as input | |
| * | |
| * @return string | |
| * The safe file name is returned. | |
| */ | |
| function filename_sanitizer($unsafeFilename){ |