PhpStorm now bundles WordPress coding style natively, starting from version 8.
- Go to
Project Settings>Code Style>PHP. - Select
Set From...(top right of window) >Predefined Style>WordPress.
No longer need to muck with this import! :)
| /*! | |
| * Dynamically changing favicons with JavaScript | |
| * Works in all A-grade browsers except Safari and Internet Explorer | |
| * Demo: http://mathiasbynens.be/demo/dynamic-favicons | |
| */ | |
| // HTML5™, baby! http://mathiasbynens.be/notes/document-head | |
| document.head || (document.head = document.getElementsByTagName('head')[0]); | |
| function changeFavicon(src) { |
| # | |
| # If you want to see svn modifications: | |
| # export SVN_SHOWDIRTYSTATE=1 | |
| # | |
| # Put this in your PS1 like this: | |
| # PS1='\u@\h:\W\[\033[01;33m\]$(__git_svn_ps1)\[\033[00m\]$ ' | |
| # Git/Subversion prompt function | |
| __git_svn_ps1() { |
| <?php | |
| /* html_convert_entities($string) -- convert named HTML entities to | |
| * XML-compatible numeric entities. | |
| */ | |
| function html_convert_entities($string) { | |
| return preg_replace_callback('/&([a-zA-Z][a-zA-Z0-9]+);/S', | |
| 'convert_entity', $string); | |
| } |
| update wp_posts set post_content = replace(post_content,'’','\''); | |
| update wp_posts set post_title = replace(post_title,'’','\''); | |
| update wp_comments set comment_content = replace(comment_content,'’','\''); | |
| update wp_postmeta set meta_value = replace(meta_value,'’','\''); | |
| update wp_posts set post_excerpt = replace(post_excerpt,'’','\''); | |
| update wp_posts set post_content = replace(post_content,'…','...'); | |
| update wp_posts set post_title = replace(post_title,'…','...'); | |
| update wp_comments set comment_content = replace(comment_content,'…','...'); | |
| update wp_postmeta set meta_value = replace(meta_value,'…','...'); |
| pm list packages -f |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| /* | |
| Plugin Name: R Debug | |
| Description: Set of dump helpers for debug. | |
| Author: Andrey "Rarst" Savchenko | |
| Author URI: https://www.rarst.net/ | |
| License: MIT | |
| */ |
| /* to use WebSQL or the SQLite plugin (https://github.com/davibe/Phonegap-SQLitePlugin) with the same function) */ | |
| executeSqlBridge: function(tx, sql, params, dataHandler, errorHandler) { | |
| var self = this; | |
| if (typeof self.db.dbPath !== 'undefined') { | |
| //Native SQLite DB with phonegap : https://github.com/davibe/Phonegap-SQLitePlugin/ | |
| //this is a native DB, the method signature is different: | |
| var sqlAndParams = [sql].concat(params); | |
| var cb = function(res) { |