Skip to content

Instantly share code, notes, and snippets.

View egoholic's full-sized avatar

Volodymyr Melnyk egoholic

View GitHub Profile
@egoholic
egoholic / fancy-tabs-demo.html
Created June 18, 2019 20:15 — forked from ebidel/fancy-tabs-demo.html
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script>
function execPolyfill() {
(function(){
// CustomElementsV1.min.js v1 polyfill from https://github.com/webcomponents/webcomponentsjs/tree/v1/src/CustomElements/v1.
/*
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@egoholic
egoholic / radix_tree.ml
Created April 7, 2018 16:23
OCaml Radix tree implementation
type 'a t = {
key: string option;
child_id: char array;
depth: int;
mutable value: 'a option;
mutable nodes: 'a t list
}
let create v = { key = Some "";
child_id = [||];
require 'net/http'
require 'net/https'
require 'google4r/checkout/notifications.rb'
require 'google4r/checkout/shared'
require 'google4r/checkout/commands'
#require 'google4r/checkout/notifications'
require 'google4r/checkout/xml_generation'
require 'google4r/checkout/frontend'
require 'google4r/checkout/merchant_calculation'
@egoholic
egoholic / wires_json.rb
Last active August 29, 2015 14:06
wires_json.rb
# 1. Wire is created
{
draft_wire: {
id: 1,
wire_id: '',
make: '',
model: '',
type: ''
color: ''
room_1_id: '',
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

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.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
# code is not mine
require 'spec_helper'
describe Api::DocumentsController do
context '#share' do
let(:name) { SecureRandom.hex }
let(:box_model) { build(:box_model, name: name) }
let(:type) { Document::TYPES.sample }
let(:pxc_number) { SecureRandom.hex }
let(:comments) { SecureRandom.hex }