Skip to content

Instantly share code, notes, and snippets.

View vsavkin's full-sized avatar

Victor Savkin vsavkin

View GitHub Profile
library test_framework;
import 'package:unittest/unittest.dart';
// RSpec like framework
typedef Closure();
class Example {
String name;
Closure body;
@vsavkin
vsavkin / domain.md
Created August 25, 2012 14:23
Building Rich Domain Models in Rails

Building Rich Domain Models in Rails

Abstract

Domain model is an effective tool for software development. It can be used to express really complex business logic, and to verify and validate the understanding of the domain among stakeholders. Building rich domain models in Rails is hard. Primarily, because of Active Record, which doesn't play well with the domain model approach.

One way to deal with this problem is to use an ORM implementing the data mapper pattern. Unfortunately, there is no production ready ORM doing that for Ruby. DataMapper 2 is going to be the first one.

Another way is to use Active Record just as a persistence mechanism and build a rich domain model on top of it. That's what I'm going to talk about here.

@vsavkin
vsavkin / angular-ends-in-toronto.md
Last active April 24, 2022 21:34
Nrwl is Hiring Angular Engineers in Toronto!

Nrwl is Hiring Angular Engineers in Toronto!

logo

Are you a Senior Angular engineer who continually self-trains to build cutting-edge skills? Do you love the challenge of helping teams with real-world product goals? Want to play with Angular thought-leaders and enterprise development teams?

We Have:

  • Distributed company with folks all over North America
class TodosEffects {
constructor(private actions: Actions, private http: Http) {}
@Effect() addTodo = this.actions.ofType('ADD_TODO').
concatMap(todo => this.http.post(…).
map(() => ({type: 'TODO_ADDED', payload: todo})));
}
function todosReducer(todos: Todo[] = [], action: any): Todo[] {
if (action.type === 'TODO_ADDED') {
@vsavkin
vsavkin / rich_domain_models2.md
Created September 1, 2012 15:29
Building Rich Domain Models in Rails (revision 2)

Building Rich Domain Models in Rails.

Part 1. Decoupling Persistence.

Abstract

Domain model is an effective tool for software development. It can be used to express really complex business logic, and to verify and validate the understanding of the domain among stakeholders. Building rich domain models in Rails is hard. Primarily, because of Active Record, which doesn't play well with the domain model approach.

One way to deal with this problem is to use an ORM implementing the data mapper pattern. Unfortunately, there is no production ready ORM doing that for Ruby. DataMapper 2 is going to be the first one.

Another way is to use Active Record just as a persistence mechanism and build a rich domain model on top of it. That's what I'm going to talk about in this article.

// Nx Devkit
export default async function (tree: Tree, options: Schema) {
generateFiles(
tree,
join(__dirname, 'files'),
join('tools/generators', options.name),
options
);
await formatFiles(tree);
}
@vsavkin
vsavkin / posts_and_comments.rb
Created March 26, 2012 02:07
Create Posts and Comments
blog = Blog.create
post = blog.make_post text: 'great post', location_country: 'Canada', location_city: 'Toronto'
post.make_comment text: 'great comment', location_country: 'Canada', location_city: 'Toronto'
@Component({
selector: 'sub-app',
providers: [{provide: PaymentService, useClass: CustomPaymentService1}],
templateUrl: `subapp1.html`})
class SubApp1 {}
@Component({
selector: 'sub-app',
providers: [{provide: PaymentService, useClass: CustomPaymentService2}],
templateUrl: `subapp2.html`})
{
"tasks": [
{
"id": "react-app:build",
"overrides": {},
"target": {
"project": "react-app",
"target": "build"
},
"command": "npm run nx -- build react-app",
const execSync = require('child_process').execSync;
const commands = JSON.parse(process.argv[2]);
const projects = commands[process.argv[3]];
const target = process.argv[4];
execSync(
`npx nx run-many --target=${target} --projects=${projects.join(
','
)} --parallel`,
{
stdio: [0, 1, 2]