This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.starRating = { | |
init: function(element, valueAccessor) { | |
$(element).addClass("starRating"); | |
for (var i = 0; i < 5; i++) | |
$("<span>").appendTo(element); | |
// Handle mouse events on the stars | |
$("span", element).each(function(index) { | |
$(this).hover( | |
function() { $(this).prevAll().add(this).addClass("hoverChosen") }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/tasks/saveform" method="post"> | |
<hidden name="tasks" data-bind="value: ko.toJSON(tasks)"></hidden > | |
<button type="submit">Save</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.dump = { | |
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext){ | |
var context = valueAccessor(); | |
var allBindings = allBindingsAccessor)(); | |
var pre = document.createElement('pre'); | |
element.appendChild(pre); | |
var dumpJSON = ko.computed({ | |
read: function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.validator.addMethod( | |
'date', | |
function (value, element, params) { | |
if (this.optional(element)) { | |
return true; | |
}; | |
var result = false; | |
try { | |
$.datepicker.parseDate('dd/mm/yy', value); | |
result = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ApplyVersionToAssemblies.ps1 | |
# | |
# Look for a 0.0.0.0 pattern in the build number. | |
# If found use it to version the assemblies. | |
# | |
# For example, if the 'Build number format' build process parameter | |
# $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) | |
# then your build numbers come out like this: | |
# "Build HelloWorld_2013.07.19.1" | |
# This script would then apply version 2013.07.19.1 to your assemblies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void Wrap(Action func) | |
{ | |
try | |
{ | |
func(); | |
} | |
catch (DbEntityValidationException ex) | |
{ | |
var error = ex.EntityValidationErrors.First().ValidationErrors.First(); | |
Debug.WriteLine(error.PropertyName + ": " + error.ErrorMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DocumentGenerator | |
{ | |
public void CreatePdf(string originalPath, string outputPath, IEnumerable<TextInfo> replacementText) | |
{ | |
// Create a new Microsoft Word application object | |
var word = new Application(); | |
// C# doesn't have optional arguments so we'll need a dummy value | |
object oMissing = System.Reflection.Missing.Value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ListExt | |
{ | |
public static bool IsNullOrEmpty<T>(this IList<T> list) | |
{ | |
return (list == null || list.Count == 0); | |
} | |
} |
OlderNewer