Get Slug of string using c#

public static string ToSlug(string value) { //First to lower case value = value.ToLowerInvariant(); //Remove all accents var bytes = Encoding.GetEncoding(“Cyrillic”).GetBytes(value); value = Encoding.ASCII.GetString(bytes); //Replace spaces value = Regex.Replace(value, @”\s”, “-“, RegexOptions.Compiled); //Remove invalid chars value = Regex.Replace(value, @”[^\w\s\p{Pd}]”, “”, RegexOptions.Compiled); //Trim dashes from end value = value.Trim(‘-‘, ‘_’); //Replace double occurences of – or \_ […]

Continue reading


Input Field in Dropdown

In your bootstrap-dropdown.js comment source code row $(‘html’).on(‘click.dropdown.data-api’, clearMenus) and write there this: $(document).bind(‘click’, function(e) { var $clicked = $(e.target); if (!$clicked.hasClass(“dropdown-menu”) && !$clicked.parents().hasClass(“dropdown-menu”)){ clearMenus(); } }); Or, you can add the following to your jQuery script $(‘.dropdown-menu’).find(‘form’).click(function (e) { e.stopPropagation(); });

Continue reading


Jquery clock ticking.

function updateClock() { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); // Pad the minutes and seconds with leading zeros, if required currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes; currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds; var currentHour […]

Continue reading