SEO Friendly Gists

In case you ever wondered if Github’s Gists are indexed when they are embedded on your website, ther aren’t 🙂

But there is a simple tool to avoid loss of traffic from Google. Go to and simply paste your gist’s id into form on this website. It will generate code that you should paste unchanged  to your WordPress post (in text mode) or whatever.

gist id
URL segment with Gist’s id.

How to change mass edit limit in Vtiger 6.5

Sometimes you need to make mass operation on houndreds of records in Vtiger. Well in this case it’s 500 ones maximum… Well this is kinda stupid because it can surely handle up to thousands. How do I know? I’ve hacked the code and successfully converted 2000 leads 🙂 Well it takes some time but it definitely works!

Let us return to the merits. You need to edit a file from root folder of your Vtiger 6.5 CRM, placed here /layouts/vlayout/modules/Vtiger/resources/List.js. Simply find the code below and edit number according to your needs:

File: List.js

		var selectedCount = this.getSelectedRecordCount();
		if(selectedCount > 2000) {
		    var params = {
			    title : app.vtranslate('JS_MESSAGE'),
			    text: app.vtranslate('JS_MASS_EDIT_LIMIT'),
			    animation: 'show',
			    type: 'error'

Log model error after save

This code:

$model = new SomeModel();
$model->attributes = $attributes;
Yii::log("errors saving SomeModel: " . var_export($model->getErrors(), true));

Will log:

2014/07/31 22:57:59 [info] [application] errors saving SomeModel: array (
  'date' => 
  array (
    0 => 'Date cannot be blank.',

How to position element absolute but inside its container?

This trick will help you place element inside its cointainer using absolute positioning. Very often you want to be very precise when placing elements. It is very hard/impossible when you anchor to entire window because browser resizing is messing everything up. To avoid this, simply set relative positioning to the wrapper element. Check demo.

Continue reading How to position element absolute but inside its container?

Simpliest way to obfuscate e-mail address using jQuery

Here is a simpliest jQuery code to protect e-mail addresses on your website from spam bots. Just put this in a script tag into the head section:

$(window).load(function() {			
	// anti spam
	var r='random-string';
	$('.'+r).each(function() {
	var $this = $(this),
		value = new String($this.text());
		value = value.replace('['+r+']', '@');
		$this.replaceWith($('').text(value).attr('href', 'mailto:'+value));

Now replace random-string with any really aleatory set of characters eg. dhhIDu338

And here is the HTML part. Publish every e-mail address on your page using this code:

Contact: <span class="random-string">johndoe[random-string]</span>

How to programmatically select option in a HTML list using jQuery?

This is very simple solution to select specified option in a HTML select list.

You just need to use the val function on a select element to set it’s value. It’s simple like that:

$('select#identificator').val('value of existing option value');

Check working example on the JSFiddle:

How to check visibility state in jQuery toggle function?

Here is a quick tip how to check visibility state of a toggled element in jQuery:

$('#element').toggle('slow', function() {
  if($(this).is(':hidden')) {
    $(this).text('This element is hidden.');
  else {
    $(this).text('This element is visible.');