This file contains hidden or 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 basicTestTemplate = "{{mycustomhelper Person.Address.City}}"; | |
var blockTestTemplate = "{{#mycustomblock Person.FirstName}} Hello world {{/mycustomblock}}"; | |
Handlebars.Handlebars.RegisterHelper ( | |
"mycustomhelper", | |
(writer, context, arguments) => writer.Write (arguments [0])); | |
Handlebars.Handlebars.RegisterHelper ( | |
"mycustomblock", (writer, options, context, arguments) => { | |
options.Template(writer, (object)context); |
This file contains hidden or 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
class MainClass | |
{ | |
private static readonly Regex HbRegex = new Regex("(?<replaceGroup>{{[^}]*}})", RegexOptions.Compiled); | |
public static void Main (string[] args) | |
{ | |
var str = "This is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}" | |
+ "This is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}" | |
+ "This is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}" | |
+ "This is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}, and this is {{Test}} of {{This}}"; |
This file contains hidden or 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 ISimpleDbItem Add<T>(this ISimpleDbItemCollection collection, string name, T entity) | |
{ | |
return collection.Add(name, | |
entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public) | |
.Where( | |
p => attributeTypes.Contains(p.PropertyType) && | |
p.GetIndexParameters().Length == 0) | |
.ToDictionary( | |
p => p.Name, | |
p => (SimpleDbAttributeValue)p.GetValue(entity, null))); |
This file contains hidden or 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
AppDomain.AssemblyLoad += (sender, args) => { | |
var regType = args.LoadedAssembly.GetType("UnityRegistration"); | |
if(regType != null){ | |
activator.CreateInstance(regType, rootUnityContainer); | |
} | |
} |
This file contains hidden or 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
<span data-bind="editableText: myText"></span> | |
<script type="text/javascript"> | |
var vm = { | |
myText: ko.observable('Hello, world!') | |
}; | |
ko.applyBindings(vm); | |
</script> |
This file contains hidden or 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 moduleA() { | |
var viewModel = { | |
activate: activate | |
}; | |
function activate() { | |
//init | |
} | |
This file contains hidden or 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
/* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ | |
.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:23px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20% |
This file contains hidden or 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
/* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ | |
!function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.p |
This file contains hidden or 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 MyBigVM = function (options) { | |
var $koThis = this; | |
var map = { | |
Items: { | |
create: function(options) { | |
var item = ko.mapping.fromJS(options.data); | |
item.blaComputed = ko.computed(function () { | |
return this.bla1() + " / " + this.bla12(); | |
}, item); | |
return item; |