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 ServiceResolverAdapter : IDependencyResolver | |
{ | |
private readonly System.Web.Mvc.IDependencyResolver dependencyResolver; | |
public ServiceResolverAdapter(System.Web.Mvc.IDependencyResolver dependencyResolver) | |
{ | |
if (dependencyResolver == null) throw new ArgumentNullException("dependencyResolver"); | |
this.dependencyResolver = dependencyResolver; | |
} |
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script> |
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
<html> | |
<head> | |
<title>Chapter 6 Section 4, Pro JavaScript Design Patterns</title> | |
</head> | |
<body> | |
<script> | |
// this is straight from the code exampes at http://jsdesignpatterns.com/ | |
// sadly, it fails with a syntax error. quoth JSLint: | |
// |
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
// Load scripts asynchronously | |
jQuery.loadAsync = function(url, callback) { | |
// Don't use $.getScript since it disables caching | |
jQuery.ajax({ | |
'url': url, | |
'dataType': 'script', | |
'cache': true, | |
'success': callback || jQuery.noop | |
}); | |
}; |
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
Choose a ticket class: <select id="tickets"></select> | |
<p id="ticketOutput"></p> | |
<script id="ticketTemplate" type="text/x-jquery-tmpl"> | |
{{if chosenTicket}} | |
You have chosen <b>${ chosenTicket().name }</b> | |
($${ chosenTicket().price }) | |
<button data-bind="click: resetTicket">Clear</button> | |
{{/if}} |
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 Control FindField(Control source, string id) | |
{ | |
Control target = source.FindControl(id); | |
if (target != null) return target; | |
foreach (Control child in source.Controls) | |
{ | |
target = this.FindField(child, id); | |
if (target != null) return target; | |
} | |
return null; |
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
define(['handlebars','text'], function (Handlebars, text) { | |
var _buildMap = {}; | |
var _buildTemplate = Handlebars.compile( | |
'define("{{pluginName}}!{{moduleName}}", ["handlebars"], function(Handlebars){'+ | |
' return {{fn}}'+ | |
'});\n' | |
); | |
return { | |
load: function (name, req, onLoad, config) { |
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
/* | |
* Extends Handlebars with a basic get method for loading external | |
* Handlebars templates. Simply pass an options object which contains | |
* the following properties: | |
* - path (required) : Path to the external template file to be loaded | |
* - success (required) : Callback invoked with the compiled loaded template. | |
* - cache (optional) : true if the template is to be cached, otherwise false. | |
* | |
* In addition to the above arguments, any jQuery/Zepto.ajax options argument | |
* can be specified as well. |
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
// includes bindings for fetching/fetched | |
var PaginatedCollection = Backbone.Collection.extend({ | |
initialize: function() { | |
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by'); | |
typeof(options) != 'undefined' || (options = {}); | |
typeof(this.limit) != 'undefined' || (this.limit = 20); | |
typeof(this.offset) != 'undefined' || (this.offset = 0); | |
typeof(this.filter_options) != 'undefined' || (this.filter_options = {}); | |
typeof(this.sort_field) != 'undefined' || (this.sort_field = ''); |
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() { | |
$('[id^="post-"]').click( | |
function() { | |
var self = $(this); | |
/** Toggle all posts except for the current one. */ | |
$('.post_content').not(self.find('.post_content')).hide(); | |
$('.image-box').not(self.find('.image-box')).show('slow', function(){}); | |
$('.post_excerpt').not(self.find('.post_excerpt')).show(500, function(){}); | |
/** Show full post but hide excerpt UI elements. */ |
OlderNewer