Skip to content

Instantly share code, notes, and snippets.

View gentoid's full-sized avatar
😃

Viktor Lazarev gentoid

😃
View GitHub Profile
@gentoid
gentoid / introrx.md
Last active August 29, 2015 14:16 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

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.

@gentoid
gentoid / 0_reuse_code.js
Last active August 29, 2015 14:16
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCi5GB0RhKDDKGZ2zPjw7Mw13EF/KQIHcWqaZ5GZ+DCqXMky5qdK+JO0ZLFZha0a+K0zESbAIhi4FPNRccg3Bh+bFx9HWpyoXTgdQpYgpAIIuOJRLfdI3IUvXzrmejTKwBxYTl1wv3OvvWaFZTFSOaAf6Hfs5/MbNJoua1XuKv6jydehEmDhcfLWUixlOeojut8ehK8PB5A9NknztxmLs5QNygtVrOWbirJ4u2EgZbX3Y7trGBb9H1LdW1iJ6xG5QuvY9sxrBSFNd0/vitJ+dMR6WHQsQzzbZZbs6g849NqVpMb1g1mCyknkxCMsCbSNmo81BBoz3oQHMTjE0/6NWSX viktor@linux
@gentoid
gentoid / environment.rb
Last active August 29, 2015 14:07
Environment
class Environment
attr_reader :vars, :parent
def initialize(parent = nil)
@parent = parent
@vars = parent ? parent.vars.clone : {}
end
def extend_env
@gentoid
gentoid / new.html.haml
Created July 18, 2014 08:09
simple HAML temlate
= form_for :article, url: articles_path do |f|
= @article
- if @article.errors.any?
#error_explanation
%h2 Ошибки при создании статьи:
%ul
- @article.errors.full_messages.each do |msg|
%li
= msg
%p
=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')
<?php
class App_ArrayInterfaceTest extends PHPUnit_Framework_TestCase {
public function testArrayInterface() {
$mock = $this->getMock('App_ArrayInterface');
$this->assertTrue($mock instanceof App_ArrayInterface);
$interface = new ReflectionClass('App_ArrayInterface');
$this->assertTrue($interface->hasMethod('toArray'));
<IfModule filter_module>
<IfModule version.c>
<IfVersion <= 2.2>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
<h1 class="loader">
<span>З</span>
<span>а</span>
<span>г</span>
<span>р</span>
<span>у</span>
<span>з</span>
<span>к</span>
<span>а</span>
</h1>
@gentoid
gentoid / Gradient 3D text
Created February 16, 2013 15:21
Gradient 3D text (source is http://codepen.io/anon/pen/JzjdL)
<h1 class="text"><span>Gradient 3D text</span></h1>
<style>
body {
background-color: #272727;
}
h1 {
font-family: "Arial", sans-serif;
font-size: 85px;
text-align: center;