Skip to content

Instantly share code, notes, and snippets.

View dimitar's full-sized avatar

Jimmy Miloseski dimitar

  • Perth, Western Australia
View GitHub Profile
namespace Generics
{
internal class Program
{
private static void Main(string[] args)
{
IList<IThing> list = new List<IThing>();
list.Add(new A());
list.Add(new B());
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"devDependencies": {
"grunt": "0.4.5",
"grunt-contrib-uglify": "0.9.1",
"grunt-contrib-watch": "0.6.1",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-concat" : "0.5.1",
@dimitar
dimitar / vnext-gruntfile.js
Last active August 29, 2015 14:26
Default gruntfile with js pipeline and bower
/// <binding ProjectOpened='watch' />
module.exports = function (grunt) {
grunt.initConfig({
clean: ["wwwroot/lib/*", "temp/"],
concat: {
all: {
src: ['Scripts/**'],
dest: 'temp/combined.js'
}
@dimitar
dimitar / Dockerfile
Created July 30, 2015 04:59
Node/Centos Dockerfile
FROM centos:centos6
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum update -y
RUN yum install -y npm
RUN yum install -y git
RUN git clone https://github.com/dimitar/HelloWorld.git /home/HelloWorld
RUN cd /home/HelloWorld; npm install
CMD ["node", "/home/HelloWorld/index.js"]
@dimitar
dimitar / eflocking-updlock.sql
Created April 29, 2015 03:39
ef6locking update lock
select 1 from <table_name> with (UPDLOCK) where <some_key> = <some_value>
@dimitar
dimitar / eflocking-transactions.cs
Created April 29, 2015 03:37
ef locking breakdown - transactions
if (Database.CurrentTransaction == null)
{
throw new InvalidOperationException("Cannot acquire lock outside a transaction.");
}
@dimitar
dimitar / ef6locking.cs
Created April 29, 2015 03:27
Pessimistic Locking in EF6
public async Task GetLockedEntity(Expression<Func<TEntity, object>> property, long key) where TEntity : class
{
if (Database.CurrentTransaction == null)
{
throw new InvalidOperationException("Cannot acquire lock outside a transaction.");
}
var expression = property.Body as UnaryExpression;
var memberExpression = expression.Operand as MemberExpression;