Programming and Exciting Things

Disable skype ads

Published on 05.06.2014

If you want to disable this annoying ads in new version of Skype you can add this line

127.0.0.1       apps.skype.com

in your host file, which are usualy located in
%systemroot%\system32\drivers\etc\hosts

[js] Parse get params in javascript

Published on 09.05.2014

Simple function for parsing get params in browser to js object

var getDict = {};
location.search.substr(1).split("&").forEach(function(item) {getDict[item.split("=")[0]] = item.split("=")[1]});

Blah

Published on 25.04.2014

The fact that you know how to use IM does not mean that I need to respond to you in real time.

Jquery modal plugin

Published on 18.03.2014

(function($) {
	$.yModal = function(element, options) {
		var defaults = {
			top : 100,
			overlay : 0.5,
			closeButton : null,
			onClose : function() {
			},
			onOpen : function() {
			}
		};
		var plugin = this;
		plugin.settings = {};
		var $element = $(element), element = element;
		plugin.init = function() {
			plugin.settings = $.extend({}, defaults, options);
		};
		plugin.open = function() {
			html = '<div id="overly"></div>';
			if ($('body').find('#overly').length != 0) {
				$('#overly').remove();
			}
			$('body').append(html);
			$('#overly').css({
				'position' : 'fixed',
				'z-index' : '9999',
				'top' : '0px',
				'left' : '0px',
				'height' : '100%',
				'width' : '100%',
				'background' : '#000',
				'display' : 'block',
				'opacity' : plugin.settings.overlay,
			});
			center_modal(element);
			plugin.settings.onOpen(element);
		};
		plugin.close = function() {
			$('#overly').remove();
			$(element).hide();
			plugin.settings.onClose(plugin);
		};
		var center_modal = function() {
			var modal_height = $(element).outerHeight();
			var modal_width = $(element).outerWidth();
			$('#overly').click(function() {
				plugin.close(element);
			});
			$(element).css({
				'display' : 'block',
				'position' : 'fixed',
				'z-index' : 99999999,
				'left' : 50 + '%',
				'margin-left' : -(modal_width / 2) + "px",
				'top' : plugin.settings.top + "px"
			});
		};
		plugin.init();
	};
	$.fn.yModal = function(options) {
		return this.each(function() {
			if (undefined == $(this).data('yModal')) {
				var plugin = new $.yModal(this, options);
				$(this).data('yModal', plugin);
			}
		});
	};
})(jQuery);
Много бързо написано плъгинче което "превръща" div-че в модално прозорче.
Достъпно на http://bitbucket.org/yuks/jquery.ymodal/src

Android Facebook SDK depricated Request.executeMeRequestAsync method

Published on 23.02.2014

От няколко месеца не ми се беше налагало да правя интеграции с Facebook SDK-то за андроид и сега покрай новото приложение разбирам че Request.executeMeRequestAsync метода вече е depricated :) Хубавото, е че Facebook този път не са направили някакви генерални промени и новия метод не изисква пренаписване.
От това

if (session.isOpened()) {
      Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
        @Override
        public void onCompleted(GraphUser user, Response response) {
			// ........... code ............. //
		}
	});
}

става на
Request.newMeRequest(session, new Request.GraphUserCallback() {
  @Override
  public void onCompleted(GraphUser user, Response response) {
    if (user != null) {
		// .... code ... //
    }
  }
}).executeAsync();

което според мен изглежда доста по красиво :D