Skip to content

Instantly share code, notes, and snippets.

View nazgob's full-sized avatar
🎯
Focusing

Przemek Owczarek nazgob

🎯
Focusing
View GitHub Profile
@nazgob
nazgob / wat
Last active August 29, 2015 13:57
random ruby learning resources
https://rubymonk.com/
http://rubykoans.com/
https://www.codeschool.com/
http://www.codewars.com/
http://ruby.learncodethehardway.org/book/
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
The-Well-Grounded-Rubyist-David-Black 2014 => amazon
Eloquent Ruby => amazon
@nazgob
nazgob / distributed
Last active August 29, 2015 14:02
List of interesting materials related to distributes systems
This is a curated list of materials related to 'distributed computing' theory and practice.
Some of them are directly related to what Base does and some are just inspiration and demo of what is possible.
Articles:
Microservices by Martin Fowler http://martinfowler.com/articles/microservices.html
Microservices and the Failure of Encapsulation https://michaelfeathers.silvrback.com/microservices-and-the-failure-of-encapsulaton
Distributed Computing https://en.wikipedia.org/wiki/Distributed_computing
Fallacies of Distributed Computing Explained http://www.rgoarchitects.com/Files/fallacies.pdf
SOA anti-pattern Transactional Integration http://arnon.me/2010/09/soa-antipattern-transactional-integration/
Nanoservices http://arnon.me/2014/03/services-microservices-nanoservices/
@nazgob
nazgob / Stirling number of the second kind
Created March 18, 2010 21:38
Stirling number of the second kind
#include <iostream>
size_t S(size_t n, size_t k)
{
if(k > n)
{
return 0;
}
else if(k == 1)
{
@nazgob
nazgob / to_file.rb
Created July 1, 2010 13:57
module snippet supporting "serialization"
#!/usr/bin/ruby
module ToFile
def filename
"object_#{self.object_id}.txt"
end
def to_f
File.open(filename, 'w') {|f| f.write(to_s)}
end
@nazgob
nazgob / ruby_tree.rb
Created July 1, 2010 12:54
tree like structure with blocks and recursion
#!/usr/bin/ruby
class Tree
attr_accessor :children, :node_name
def initialize(name, children)
@children = children
@node_name = name
end
@nazgob
nazgob / roman_num.rb
Created July 11, 2010 13:55
Roman numbers / method missing
class Roman
def self.method_missing name, *args
roman = name.to_s
roman.gsub!("IV" , "IIII" )
roman.gsub!("IX" , "VIIII" )
roman.gsub!("XL" , "XXXX" )
roman.gsub!("XC" , "LXXXX" )
(roman.count("I" ) +
roman.count("V" ) * 5 +
roman.count("X" ) * 10 +
TEST_F(SExpTest, SExpWithOperator)
{
// (2 3)
SExp* valuePair = new SExp(a, b);
// (+, (2 3)) = 5
SExp* addOpWithValue = new SExp(new AddOperator(), valuePair);
EXPECT_EQ(5, addOpWithValue->Evaluate(context));
delete addOpWithValue;
@nazgob
nazgob / Rakefile_for_cpp.rb
Created November 25, 2010 10:22
sample Rakefile for building c++ project / inc lib / .rb extension just for GH to color stuff
require 'rake/clean'
PROG = "foo"
LIBNAME = PROG
LIBFILE = "lib#{LIBNAME}.a"
SRC = FileList['**/*.cpp']
OBJDIR = 'obj'
OBJ = SRC.collect { |fn| File.join(OBJDIR, File.basename(fn).ext('o')) }
@nazgob
nazgob / birds_classic.cpp
Created February 27, 2011 15:35
"classic" OO solution for birds problem
#include <iostream>
class Bird
{
public:
virtual void Fly() const = 0;
virtual void Speak() const = 0;
};
class Eagle : public Bird
@nazgob
nazgob / birds_style.cpp
Created February 27, 2011 15:37
"better" solution for OO birds problem
#include <iostream>
#include <cassert>
class FlyStyle
{
public:
virtual void Fly() const = 0;
};
class FlyHigh : public FlyStyle