Skip to content

Instantly share code, notes, and snippets.

View andrzejkrzywda's full-sized avatar

Andrzej Krzywda andrzejkrzywda

View GitHub Profile
@andrzejkrzywda
andrzejkrzywda / 0_reuse_code.js
Created January 12, 2014 13:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@andrzejkrzywda
andrzejkrzywda / Plea.markdown
Created June 22, 2012 21:19 — forked from justinko/Plea.markdown
Am I doing it wrong?

Here is my solution, based on use-cases and AOP.

  1. you need to separate persistence from your domain
  2. you need to have a proper use-case, not a single request-class, like above.
  3. notifications are notifications (twitter, fb), they are implemented with AOP
  4. spam detection and language detection are separated (discussable) with an aspect.
  5. there is an "app" object that wraps it all together.

The first file is the original example. The second file is mine.

@andrzejkrzywda
andrzejkrzywda / object_key_test.rb
Created July 14, 2011 09:53 — forked from paneq/test.rb
Which version do you prefere?
require 'test/unit'
class KeyTest < Test::Unit::TestCase
def test_key
object = Object.new
assert_equal(:submit, object_key(object))
def object.persisted?; true end
assert_equal(:update, object_key(object))