Skip to content

Instantly share code, notes, and snippets.

Michal J. wejn

Block or report user

Report or block wejn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View service-checklist.md

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@wejn
wejn / Ex0105.rb
Created Nov 24, 2014
Cracking the Code Interview, Exercise 1.5
View Ex0105.rb
#!/usr/bin/env ruby
module Ex0105
def self.compress(str)
out = str.scan(/./).reduce([[], 't', 0]) do |(buf, cur, num), c|
if cur == c
[buf, cur, num + 1]
else
if num > 0
buf << cur
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View gist:33958eab3270b1566bb4
### Keybase proof
I hereby claim:
* I am wejn on github.
* I am wejn (https://keybase.io/wejn) on keybase.
* I have a public key whose fingerprint is CC15 927C 8B00 1927 15EA E5C0 8911 469B 691A 16D4
To claim this, I am signing this object:
@wejn
wejn / gist:4966076
Last active Dec 13, 2015
add shebang, fix loop, fix conversion, fix formatting
View gist:4966076
#!/usr/bin/env ruby
# encoding: utf-8
bill = nil
loop do
print "\rHow much you bill was (CZK): "
bill = gets
begin
bill = Integer(bill)
break
rescue Object
@wejn
wejn / gist:1709758
Created Jan 31, 2012
Ruby Koans - About Hashes - why breaking out the hash is necessary?
View gist:1709758
def test_changing_hashes
hash = { :one => "uno", :two => "dos" }
hash[:one] = "eins"
expected = { :one => "eins", :two => "dos" }
assert_equal true, expected == hash
assert_equal true, { :one => "eins", :two => "dos" } == hash
# Bonus Question: Why was "expected" broken out into a variable
# rather than used as a literal?
You can’t perform that action at this time.