Recently we had to add a expand collapse icons for the navigation menu on mobile devices in our WordPress theme. We can not use pseudo-classes :after and :before as they are not part of the dom and any events registered on them won’t work. So for our mobile menus, we added a <span> tag like
jQuery/Javascript click event not working on and elements in iOS Safari webkitHow to enable auto complete for git commands and branches on Mac OSX terminal / Command line
If you want to enable tab auto complete at the command line on Mac OSX terminal, there is a handy auto-completion script you can use. https://github.com/git/git/blob/master/contrib/completion/git-completion.bash Using git-completion script to enable auto complete for GIT commands Download and save the git-completion script to your home directory curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash Then open the .bash_profile file
Adding dynamic classes to your custom WordPress widgets
I recently released an ad management plugin for WordPress called “Easy AdSense Ads & Scripts Manager“. In this plugin we have a custom widget with option to remove the padding and borders (if any) added by the theme. I did not think much before implementing this feature and was expecting WordPress to have some kind of hook
error: command ‘cc’ failed with exit status 1; Can’t install PIL, Pillow, MySql and other packages in Mavericks.
If you are getting the following error when installing python packages using PIP or easy_install, don’t worry. You have come to the right place for solution. First make sure you have developer tools installed. You can install them by executing the following command in terminal xcode-select –install The clang errors are due to changes introduced in
2 Common errors while setting up phpMyAdmin on Mac OSX
You might encounter the following two errors while installing phpMyAdmin on OSX Login without password is forbidden by the configuration ( See AllowNoPassword ) #2002 can not login tot the MySQL server Here are the fixes for the above two errors. 1. Open phpMyAdmin configuration located at (phpMyAdmin Folder)/config.inc.php and change $cfg[‘Servers’][$i][‘AllowNoPassword’] = False; to
Unable to connect mysql on OSX form PHP
If you are unable to connect to mysql from PHP and you are sure that MYSQL is running, then try changing your host name from localhost to 127.0.0.1
Django | Set the defulat ordering rule for queries in the models
Though we can specify order explicitly in queries like below Posts.objects.order_by(‘published’) it is repetitive and most of the times we will want to order by a particular field. We can specify the order in the models like this class Post(models.Model): title = models.CharField(max_length=140) content = models.TextField() published = models.DateTimeField() def __unicode__(self): return self.title class Meta:
Restrict Django Templates From Deleting Data.
Django allows method calls inside template system. Though this is an useful feature, some of the methods will have side effects. Mostly the ones that alter data. Say, for instance, you have a UserAccount object that has a delete() method. If a template includes something like {{ account.delete }}, where account is a UserAccount object,
What do Dollar and Caret ( $ and ^) sign in Django urls mean?
$ and ^ are regular expression characters that have a special meaning: the caret means “require that the pattern matches the start of the string,” and the dollar sign means “require that the pattern matches the end of the string.” For example consider the following url pattern urlpatterns = patterns(”, url(r’^hello/$’, hello), ) Without the
Mongod error | exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid
I got this error while trying to start mongodb on amazon ec2. Running this command in the terminal solved the problem. export LC_ALL=C I don’t have any idea about what it means at this time except that it sets the terminal to display all languages. If you can explain what actually it does, please drop
How to enable auto complete for git commands and branches on Mac OSX terminal / Command line
If you want to enable tab auto complete at the command line on Mac OSX terminal, there is a handy auto-completion script you can use. https://github.com/git/git/blob/master/contrib/completion/git-completion.bash Using git-completion script to enable auto complete for GIT commands Download and save the git-completion script to your home directory curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash Then open the .bash_profile file
Adding dynamic classes to your custom WordPress widgets
I recently released an ad management plugin for WordPress called “Easy AdSense Ads & Scripts Manager“. In this plugin we have a custom widget with option to remove the padding and borders (if any) added by the theme. I did not think much before implementing this feature and was expecting WordPress to have some kind of hook
error: command ‘cc’ failed with exit status 1; Can’t install PIL, Pillow, MySql and other packages in Mavericks.
If you are getting the following error when installing python packages using PIP or easy_install, don’t worry. You have come to the right place for solution. First make sure you have developer tools installed. You can install them by executing the following command in terminal xcode-select –install The clang errors are due to changes introduced in
2 Common errors while setting up phpMyAdmin on Mac OSX
You might encounter the following two errors while installing phpMyAdmin on OSX Login without password is forbidden by the configuration ( See AllowNoPassword ) #2002 can not login tot the MySQL server Here are the fixes for the above two errors. 1. Open phpMyAdmin configuration located at (phpMyAdmin Folder)/config.inc.php and change $cfg[‘Servers’][$i][‘AllowNoPassword’] = False; to
Unable to connect mysql on OSX form PHP
If you are unable to connect to mysql from PHP and you are sure that MYSQL is running, then try changing your host name from localhost to 127.0.0.1
Django | Set the defulat ordering rule for queries in the models
Though we can specify order explicitly in queries like below Posts.objects.order_by(‘published’) it is repetitive and most of the times we will want to order by a particular field. We can specify the order in the models like this class Post(models.Model): title = models.CharField(max_length=140) content = models.TextField() published = models.DateTimeField() def __unicode__(self): return self.title class Meta:
Restrict Django Templates From Deleting Data.
Django allows method calls inside template system. Though this is an useful feature, some of the methods will have side effects. Mostly the ones that alter data. Say, for instance, you have a UserAccount object that has a delete() method. If a template includes something like {{ account.delete }}, where account is a UserAccount object,
What do Dollar and Caret ( $ and ^) sign in Django urls mean?
$ and ^ are regular expression characters that have a special meaning: the caret means “require that the pattern matches the start of the string,” and the dollar sign means “require that the pattern matches the end of the string.” For example consider the following url pattern urlpatterns = patterns(”, url(r’^hello/$’, hello), ) Without the
Mongod error | exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid
I got this error while trying to start mongodb on amazon ec2. Running this command in the terminal solved the problem. export LC_ALL=C I don’t have any idea about what it means at this time except that it sets the terminal to display all languages. If you can explain what actually it does, please drop