Skip to content

Instantly share code, notes, and snippets.

View alexeyzimarev's full-sized avatar
🎖️
Protecting common sense

Alexey Zimarev alexeyzimarev

🎖️
Protecting common sense
View GitHub Profile
@alexeyzimarev
alexeyzimarev / Todo.js
Created March 21, 2016 20:06
Todo functional React component
import React, { PropTypes } from 'react'
const Todo = ({ onClick, completed, text }) => (
<li
onClick={onClick}
style={{
textDecoration: completed ? 'line-through' : 'none'
}}
>
{text}
@alexeyzimarev
alexeyzimarev / Todo.tsx
Created March 21, 2016 20:12
TypeScript version of React functional component
/// <reference path="../typings/browser.d.ts" />
import React, { PropTypes } from 'react';
interface TodoProps {
onClick: any;
completed: boolean;
text: string;
}
@alexeyzimarev
alexeyzimarev / AutofacDependencyResolver.cs
Last active May 31, 2016 16:09
Autofac version of ReactiveUI IMutableDependencyResolver
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Autofac.Core;
namespace ReactiveUI
{
public class AutofacDependencyResolver : IMutableDependencyResolver
internal class SubscribeObserver : IRunOnStartAndStop
{
private readonly IBus _bus;
public SubscribeObserver(IBus bus)
{
_bus = bus;
}
public void OnBeforeStart()
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
namespace MassTransit.EntityFrameworkIntegration
{
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
using System.Reflection;
public class AssemblyScanningSagaDbContext : DbContext
@alexeyzimarev
alexeyzimarev / BaseHandler.cs
Last active July 12, 2017 18:50
Using this base class you can handle your messages without extracting them first from the context. Context is still available.
using System.Threading.Tasks;
using MassTransit;
namespace Demo.MassTransit
{
public abstract class BaseHandler<T> : IConsumer<T> where T : class
{
protected ConsumeContext<T> Context { get; private set; }
public abstract Task Handle(T message);
@alexeyzimarev
alexeyzimarev / NHibernateSqlProcedureHelper.cs
Created December 12, 2014 10:21
Execute stored procedure and get return value, using NHibernate session
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using NHibernate;
namespace NHibernate.Helpers
{
public static class SqlProcedureHelper
{
<!DOCTYPE html>
<head>
<title>HTML5 Camera Fun</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://www.nihilogic.dk/labs/exif/exif.js" type="text/javascript"></script>
<script src="http://www.nihilogic.dk/labs/binaryajax/binaryajax.js" type="text/javascript"></script>
<script type="text/javascript">
// Wrapper around MPL-licensed http://www.nihilogic.dk/labs/binaryajax/binaryajax.js
// to support JavaScript typed arrays since binary strings are not supported in IE 10
var createBinaryFile = function(uintArray) {
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "ClassifiedAds"
},
"paths": {
"/ad": {
"post": {
"tags": [