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 class ReflectionExtensions | |
{ | |
public static void FindImplementationsInSameAssemblyAs<T>( | |
this Type type, | |
Action<Type, Type> action) | |
{ | |
var assembly = typeof(T).GetTypeInfo().Assembly; | |
var query = | |
from implementationType in assembly.GetTypes() |
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 SpecialCamelCasePropertyNamesContractResolver : | |
CamelCasePropertyNamesContractResolver | |
{ | |
protected override JsonDictionaryContract CreateDictionaryContract( | |
Type objectType) | |
{ | |
var contract = base.CreateDictionaryContract(objectType); | |
contract.DictionaryKeyResolver = propertyName => propertyName; |
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
namespace MyApp | |
{ | |
public sealed class Int | |
{ | |
public static readonly DependencyProperty AttachedProperty = DependencyProperty.RegisterAttached( | |
"IntAttached", typeof(bool), typeof(Int), null); | |
public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached( | |
"Value", typeof(int), typeof(Int), new PropertyMetadata(null, OnAttach)); |
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 properties = { Two:true, Three:1 }; | |
var filters = ['One===true', 'Two===true', 'Three>6', 'Three<6 || Two===true']; | |
var fnString = ''; | |
for(var name in properties) { | |
fnString +='var '+name+'='+properties[name]+';\n'; | |
} | |
console.log(fnString); |
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 class Extensions | |
{ | |
public static void AddOnce<TEntity>( | |
this IDbSet<TEntity> set, | |
Expression<Func<TEntity, object>> identifierExpression, | |
params TEntity[] entities) where TEntity : class | |
{ | |
if (set == null) throw new ArgumentNullException("set"); | |
if (identifierExpression == null) throw new ArgumentNullException("identifierExpression"); | |
if (entities == null) throw new ArgumentNullException("entities"); |
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
/// <reference path="~/Scripts/jasmine/jasmine.js" /> | |
/// <reference path="~/Scripts/angular.js" /> | |
/// <reference path="~/Scripts/angular-mocks.js" /> | |
/// <reference path="~/Scripts/Common/Collections/keyed-collection.js" /> | |
describe('keyed-collection', function () { | |
beforeEach(module('common.collections.keyedCollection')); | |
describe('keyed-collection service', 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
public class CreateQRService : | |
ICreateQRService | |
{ | |
readonly Log.Delegate _log; | |
byte[] _qr; | |
public CreateQRService( | |
Log.Delegate log) | |
{ | |
_log = log; |
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 someFunction = function(text, moreThings) { | |
var moreThingsArray = paramArray(moreThings, arguments, 1); | |
// ... do stuff | |
}; | |
someFunction('test with array', [new thing(), new thing()]); | |
someFunction('test with params', new thing(), new thing()); |
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
// what the data looks like | |
// demo http://jsbin.com/yocolomife/1/edit?html,js,output | |
scope.things = [ | |
{ id : 1, name: 'raindrows on roses' }, | |
{ id : 2, name: 'wiskers on kittens' }, | |
{ id : 3, name: 'brown paper packages tied up with strings' } | |
]; | |
scope.myModel = { |
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
<!DOCTYPE html> | |
<html ng-app="antix.cells"> | |
<head> | |
<meta name="description" content="angularjs cell layout" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style> |