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 Func<T,T> AsProjections<T>(string fields) where T: class | |
| { | |
| var xParameter = Expression.Parameter(typeof(T), "o"); | |
| var xNew = Expression.New(typeof(T)); | |
| var bindings = fields.Split('.') | |
| .Select(o => o.Trim()) | |
| .Select(o => | |
| { |
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
| <!-- JQuery 2.11 --> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
| <!-- Require 2.1.11 --> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.11/require.min.js"></script> | |
| <!-- Underscore 1.60 --> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script> | |
| <!-- RxJs 2.2.24 --> |
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
| $rootScope.$broadcast('scanner-started', { any: {} }); | |
| $scope.$on('scanner-started', function(event, args) { | |
| var anyThing = args.any; | |
| }); |
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
| // Файл myModule.js - определяем | |
| define(function() { | |
| var app = { | |
| val: 1 | |
| }; | |
| return app; | |
| }); | |
| // в любом другом файле |
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 js = new HtmlGenericControl("script"); | |
| js.Attributes["type"] = "text/javascript"; | |
| js.Attributes["src"] = "myFile.js"; | |
| Page.Header.Controls.Add(js); |
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 class NHibernateContractResolver : DefaultContractResolver { | |
| protected override List<MemberInfo> GetSerializableMembers(Type objectType) { | |
| if (typeof(INHibernateProxy).IsAssignableFrom(objectType)) { | |
| return base.GetSerializableMembers(objectType.BaseType); | |
| } else { | |
| return base.GetSerializableMembers(objectType); | |
| } | |
| } | |
| } |
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
| app.directive("repeatComplete", function( $rootScope ) { | |
| // уникальный ID (ведь может быть несколько вложенных ng-repeat) | |
| var uuid = 0; | |
| // компилируем DOM узел до того как он будет залинкован директивой ng-repeat | |
| function compile( tElement, tAttributes ) { | |
| // получаем уникальный ID | |
| var id = ++uuid; |
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
| angular.module('myApp', []).directive('numbersOnly', function(){ | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, element, attrs, modelCtrl) { | |
| modelCtrl.$parsers.push(function (inputValue) { | |
| if (inputValue == undefined) return '' | |
| var transformedInput = inputValue.replace(/[^0-9]/g, ''); | |
| if (transformedInput!=inputValue) { | |
| modelCtrl.$setViewValue(transformedInput); | |
| modelCtrl.$render(); |
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
| 1: Access Scopes | |
| angular.element(targetNode).scope() | |
| // ChildScope {$id: "005", this: ChildScope, $$listeners: Object, $$listenerCount: Object, $parent: Scope…} | |
| angular.element(targetNode).isolateScope() | |
| // Scope {$id: "009", $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: ChildScope, $$nextSibling: Scope…} | |
| 2: Grab any Services | |
| angular.element('html').injector().get('MyService') | |
| // Object {undo: function, redo: function, _pushAction: function, newDocument: function, init: function…} |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq.Expressions; | |
| using System.Reflection; | |
| namespace Helpers { | |
| public static class NotNull { | |
| public static TProp Get<TSource, TProp>(this TSource source, Expression<Func<TSource, TProp>> property) where TSource : class { | |
| if (source == null) return default(TProp); | |
| var current = property.Body; |
OlderNewer