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
var things = [ | |
new Thing1(), | |
new Thing1(), | |
new Thing2() | |
]; | |
var OnlyThingOnes = things.filter(function(t){return t.thingOneOnlyProperty !== undefined}); |
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
function hasItems(data) { | |
var value = ko.unwrap(data), | |
result = false; | |
if (value.length && value.length > 0) | |
result = true; | |
return result; | |
} |
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.href = { | |
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { | |
return ko.bindingHandlers['attr']['update'](element, function () { | |
return { href: valueAccessor() }; | |
}, allBindings, viewModel, bindingContext); | |
} | |
} |
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
$cd = Add-Type -memberDefinition @" | |
[DllImport("winmm.dll", CharSet = CharSet.Ansi)] public static extern int mciSendStringA(string lpstrCommand, string lpstrReturnString, int uReturnLength, IntPtr hwndCallback); | |
"@ -passthru -name mciSendString\ | |
# Where F an G are the Drive letters | |
$cd::mciSendStringA("set cdaudio!F door closed wait", $null, 1, 1); | |
$cd::mciSendStringA("set cdaudio!G door closed wait", $null, 1, 1); |
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
// asObservable or asObservableArray: if passed an observable use that instance otherwise wrap it in a new observable | |
var myModel = function(options){ | |
var self = this; | |
self.observable = ko.asObservable(options.possibleObservable); | |
self.observableArray = ko.asObservableArray(options.possibleObservableArray); | |
return self; | |
} | |
// Trackable Observables: the ability to revert to a "good" value | |
var myForm = 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
<section class="release"> | |
<h2>NuGet 1.6 Coming Soon!</h2> | |
<p> | |
NuGet 1.6 is coming soon so stay tuned for more information! Why, wait though NuGet 1.5 has already been released so | |
head over to our docs site and <a href="http://docs.nuget.org/docs/release-notes/nuget-1.5">read all the details</a> of that release. | |
</p> | |
</section> |
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
if ($commitSha -eq $null) { | |
$commitSha = (& "$gitPath" rev-parse HEAD) | |
} | |
if ($commitBranch -eq $null) { | |
$commitBranch = (& "$gitPath" name-rev --name-only HEAD) | |
} |
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
var formatters = { | |
errors: function (errors, lines, file) { | |
var i, error; | |
for (i = 0; i < errors.length; i++) { | |
error = errors[i]; | |
if (!error) continue; | |
lines.push(file + '(' + error.line + ',' + error.character + '): error JSHint: ' + error.reason); | |
} | |
}, |
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
function _getWidgetBindings(element, valueAccessor, allBindingsAccessor) { | |
var value = valueAccessor(), | |
myBinding = ko.utils.unwrapObservable(value), | |
allBindings = allBindingsAccessor(); | |
if (typeof (myBinding) === 'string') { | |
myBinding = { 'name': myBinding }; | |
} | |
var widgetName = myBinding.name, |
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
<!-- Simple Binding --> | |
<input type="submit" value="OK" data-bind='widget: "button"' /> | |
<!-- Complex Binding with options --> | |
<input id='search' data-bind='widget: { name: "autocomplete", options: { source: searchCompletions(), delay: 500 } }, value: searchString' /> |
OlderNewer