Category Archives: Cats who code

10 jQuery snippets for efficient web development

Detect Internet Explorer

When it comes to CSS design, Internet Explorer has always been a problem for developpers and designers. Althought the dark ages of IE6 are now gone and IE is les and less popular, it still a good thing to be able to detect it easily. Of course, this snippet can be used to detect other browsers as well.

$(document).ready(function() {
      if (navigator.userAgent.match(/msie/i) ){
        alert('I am an old fashioned Internet Explorer');
      }
});

Source: Stack Overflow

Smooth scrolling to top of the page

Here is one of the most widely used jQuery effects: a click on a link will smoothly scroll the page to the top. Nothing new here, but a must have as every developer will have to code similar functions every once in a while.

$("a[href='#top']").click(function() {
  $("html, body").animate({ scrollTop: 0 }, "slow");
  return false;
});

Source: Stalk Overflow

Stay on top

A very handy code snippets which allows an element to stay fixed on top. Super useful for navigation menus, toolbars or important messages.

$(function(){
	var $win = $(window)
	var $nav = $('.mytoolbar');
	var navTop = $('.mytoolbar').length && $('.mytoolbar').offset().top;
	var isFixed=0;
 
	processScroll()
	$win.on('scroll', processScroll)
 
	function processScroll() {
	var i, scrollTop = $win.scrollTop()
 
	if (scrollTop >= navTop && !isFixed) { 
		isFixed = 1
		$nav.addClass('subnav-fixed')
	} else if (scrollTop <= navTop && isFixed) {
		isFixed = 0
 		$nav.removeClass('subnav-fixed')
	}
}

read more

De:comments WordPress plugin giveaway!

A word about de:comments

decomments

De:comments is a WordPress plugin which allows you to enhance the comments section of your blog. Key features include:

  • Multilingual: Already supports English, French, German, Polish, Russian, Ukrainian, Brazilian, Portuguese, Italian, Spanish, Dutch and Turkish.
  • Easy to customize: Open CSS-file so you can add your own web-site styles.
  • Single Sign-on with social networks: Plugin collects all users to your base and they can login from social networks also.
  • Supports WP multisite: One license is valid for all your networks.
  • Voting system: You can allow users to like and dislike each other’s comments. All information about those is stored in your database.
  • Badge system: Encourage the most active users by adding a gamification to commenting process.
  • Media-attachments: Plugin interacts with pictures (even GIFs) perfectly and embeds from social network.
  • Responsive: If your site is responsive the comments will also look wonderful on the mobile screen. Of course it’s Retina.

Pricing goes as follow: $50 for one site, $100 for 3 sites and $300 for ten sites. All prices include one year of free updates and support.

Now that I gave you an overview of how De:comments can improve your blog, the best you can do is to test the plugin and see by yourself. To do so, just head over the demo site.

Don’t forget to follow De:comments on Facebook or Twitter.

read more

De:comments WordPress plugin giveaway!

A word about de:comments

decomments

De:comments is a WordPress plugin which allows you to enhance the comments section of your blog. Key features include:

  • Multilingual: Already supports English, French, German, Polish, Russian, Ukrainian, Brazilian, Portuguese, Italian, Spanish, Dutch and Turkish.
  • Easy to customize: Open CSS-file so you can add your own web-site styles.
  • Single Sign-on with social networks: Plugin collects all users to your base and they can login from social networks also.
  • Supports WP multisite: One license is valid for all your networks.
  • Voting system: You can allow users to like and dislike each other’s comments. All information about those is stored in your database.
  • Badge system: Encourage the most active users by adding a gamification to commenting process.
  • Media-attachments: Plugin interacts with pictures (even GIFs) perfectly and embeds from social network.
  • Responsive: If your site is responsive the comments will also look wonderful on the mobile screen. Of course it’s Retina.

Pricing goes as follow: $50 for one site, $100 for 3 sites and $300 for ten sites. All prices include one year of free updates and support.

Now that I gave you an overview of how De:comments can improve your blog, the best you can do is to test the plugin and see by yourself. To do so, just head over the demo site.

Don’t forget to follow De:comments on Facebook or Twitter.

read more

Introduction to Mailtrap: A fake SMTP server for pre-production testing of application email

Using Mailtrap is free for most development tasks. It was created by Railsware team. Essentially, you sign up for Mailtrap and send all of your pre-production environment email via your fake Mailtrap SMTP server.

Later on, all of your emails are introduced to Mailtrap SMTP software. You can view and debug your email within Mailtrap’s friendly GUI.
ou can even use Mailtrap to place dumps of your production database with real user emails through tests on your staging server. Your automated tests can run against the real data—sending emails via Mailtrap, eliminating the risk that test emails go out to real customer email addresses.

How Much Does Mailtrap Cost?

Mailtrap is free for small developers or small tasks. Costs vary between $120 and $300 annually for bigger enterprises.

Let’s Get Started With Mailtrap

You can choose different way to sign up – fill out the registration form or use your Google\Github account:

I used my GitHub account to simplify the process.

After being confirmed, you can find your personal demo inbox:

Mailtrap Settings

Mailtrap can be set up perfectly within your development environment. When you click on the Settings icon in the inbox list, you see that each Mailtrap inbox has its own SMTP server credentials:

You can reset these credentials whenever you want. Various configurations can be found within Mailtrap settings:

For simplicity, I will use the Hello application from our Programming With Yii2 series to configure Mailtrap. If you wish to use the code from there to test Mailtrap, clone the GitHub repository linked to this tutorial.

With Yii, I’m updating the SwiftMailer SMTP settings in config/web.php. Here’s the default:

Which I changed with my Mailtrap settings:

'errorHandler' => [ 
    'errorAction' => 'site/error', 
], 

'mailer' => [ 
    'class' => 'yii\swiftmailer\Mailer', 
    'viewPath' => '@app/mailer', 
    'useFileTransport' => false, 
    'transport' => [ 
        'class' => 'Swift_SmtpTransport', 
        'host' => 'mailtrap.io', 
        'username' => '294XXXXXXXXXXdd20', 
        'password' => '403XXXXXXXXXX2f7', 
        'port' => '25', 
        'encryption' => 'tls', 
    ], 
], 

'log' => [ 
    'traceLevel' => YII_DEBUG ? 3 : 0,

read more

InMotion Hosting review and giveaway

A word about InMotion

InMotion Hosting is an employee-owned and -operated domain name and web hosting company that was founded in 2001. Its web hosting network is based on Linux and Unix operating systems. The company provides a wide range of web hosting solutions, including business class hosting, VPS hosting, personal/cheap hosting and dedicated servers.

What I tested

I was offered to test the popular “Launch Plan”, an all-in-one starter pack for personal websites and blogs. Because InMotion Hosting knows that I’m very interested in WordPress (as well as most of my readers) they thought that plan would be a great pick for me to try.

read more