Skip to content

Instantly share code, notes, and snippets.

@dschenkelman
dschenkelman / MyClass.js
Created May 9, 2014 04:46
To Arrow Function or not to Arrow Function
var MyClass = (function () {
function MyClass() {
}
MyClass.prototype.add = function (a, b) {
return a + b;
};
MyClass.prototype.partialAdd = function (a) {
var _this = this;
return function (b) {
return _this.add(a, b);
@dschenkelman
dschenkelman / CompositeDatabaseInitializer.cs
Created May 9, 2014 04:51
Creating Indexes via Data Annotations with Entity Framework 5.0
using System.Collections.Generic;
using System.Data.Entity;
public class CompositeDatabaseInitializer<T> : IDatabaseInitializer<T> where T : DbContext
{
private readonly List<IDatabaseInitializer<T>> initializers;
public CompositeDatabaseInitializer(params IDatabaseInitializer<T>[] databaseInitializers)
{
this.initializers = new List<IDatabaseInitializer<T>>();
@dschenkelman
dschenkelman / Everything.cs
Created May 9, 2014 04:57
Needle Container: Fluency and Mapping Types
needleContainer
.Map<IForceEnlightened>()
.To<Jedi>()
.WithId("Yoda")
.UsingLifetime(RegistrationLifetime.Singleton)
.Commit();
@dschenkelman
dschenkelman / RootBindingExtension.cs
Created May 9, 2014 05:01
Binding to View Model properties in Data Templates. The RootBinding Markup Extension
public class RootBindingExtension : IMarkupExtension<Binding>
{
public string Path { get; set; }
public Binding ProvideValue(IServiceProvider serviceProvider)
{
IRootObjectProvider rootProvider = (IRootObjectProvider) serviceProvider.GetService(typeof(IRootObjectProvider));
var view = rootProvider.RootObject;
var fe = view as FrameworkElement;
@dschenkelman
dschenkelman / MVP.cs
Last active August 29, 2015 14:01
MMC 3.0 Sample Plug-In using MVP and Unity
public class ConnectionListView : MmcListView, IConnectionListView
{
private readonly IConnectionListPresenter presenter;
public ConnectionListView()
{
var container = this.SnapIn.Tag as IUnityContainer;
@dschenkelman
dschenkelman / sample.js
Last active August 29, 2015 14:01
Frozen Proxies
var immutable = (function(){
function isFunction(f) {
var getType = {};
return f && getType.toString.call(f) === '[object Function]';
}
function shallowCopy(object){
var copy = Object.create(Object.getPrototypeOf(object));
Object.getOwnPropertyNames(object).forEach(function (name){
Perfil,Horario acceso,IP,Accesos inválidos,Clasificación
16,2,1,3,1
2,4,1,3,1
11,4,1,3,1
2,4,1,2,1
30,4,1,3,1
1,4,1,2,1
14,4,1,3,1
8,8,1,3,1
6,8,1,2,1
@dschenkelman
dschenkelman / CustomAuth0Client.cs
Last active August 29, 2015 14:07
Xamarin Auth0Client with support for lang in widget
using System.Reflection;
using Xamarin.Auth;
public class CustomAuth0Client : Auth0.SDK.Auth0Client {
private const string AuthorizeUrl = "https://{0}/authorize?client_id={1}&redirect_uri={2}&response_type=token&connection={3}&scope={4}";
private const string LoginWidgetUrl = "https://{0}/login/?client={1}&redirect_uri={2}&response_type=token&scope={3}";
private readonly string domain;
private readonly string clientId
@dschenkelman
dschenkelman / bad.cs
Created April 6, 2015 20:27
C# foreach tasks
async Task FetchUrls(IEnumerable<string> urls)
foreach (var url in urls){
await fetch(url);
}
}
@dschenkelman
dschenkelman / faketalk.md
Created October 20, 2015 03:47
Fake talk

Rise of microservices

In an era were parallelism is important, it is key to take advantage of multiple processors to leverage our maximum computing power. However, most languages and VMs rely on thread pools and schedulers to manage work and assign work to machine cores, which might lead to either an excessive need for tuning or wasted resources.

In this talk I will explain why JavaScript and in particular it’s server side implementation: node.js can help take advantage of all your resources by providing a scalable infrastructure based on microservices, taking advantage of single thread processes that rely on an event loop. The demos will make use of containerization techiques using Docker to explain how these services can be easily deployed and can communicate in a cloud enviroment.