Skip to content

Instantly share code, notes, and snippets.

Oleg Ivanov morhekil

Block or report user

Report or block morhekil

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 gist:95403e0fd1660443ed6d8d93ae3c09ca

Node.js Workshop


  • Install node
  • Download repo and get it running
  • Sign up for trial account for lambda service

Day 1

View irbrc
# Some default enhancements/settings for IRB, based on
require 'irb'
unless defined? ETC_IRBRC_LOADED
# Require RubyGems by default.
require 'rubygems'
# Activate auto-completion.
morhekil / case.js
Created Aug 29, 2017
mobx computed behaviour test case
View case.js
import { whyRun, observable, computed } from 'mobx';
class Store {
@observable value = false;
@computed get notValue() {
return !this.value;
View tryme.rb
class Tryme
def call1
target = 'boom'
puts target
def call2 = 'boom'
puts target
morhekil /
Last active Jan 24, 2018 — forked from wayne5540/
This article is to show how to inject JavaScript into iframs under iOS web view and so we can communicate with it.

[iOS - Swift] How to communicate with iFrames inside WebView

One of the core technologies at the heart of Onefill is its ability to auto-fill even the most complex form on a website with 100% precision, with a single tap. And the techology that built does allow us to do just that, but with one exception - iframes.

And while you might think that iframes are a thing of the past (who would use them these days, right?) - the reality is that they're often powering some of the most critical piece of functionality there is on online store - its payment


Building a GraphQL API in Rails - Part 1

This is a series blog post cover above three topics of GraphQL:

  1. About GraphQL
  2. Building a basic API with Rails
  3. Some best practices

GraphQL has been around for a while already, and it is not a new thing. The reason I decided to investigate it is because Github have recently released their GraphQL API alpha. Github has been on a forefront of API-driven development for quite some time now, and their RESTful API is an exemplary API design used as a reference by many developers - so it's pretty interesting to see what's new they have released.


Validate JSON schema in Rails


  1. What/Why JSON schema
  2. Apply to rails model validation
  3. Test your API endpoint with schema matcher
  4. Homework for a curious reader
  5. References
morhekil /
Created Oct 8, 2016
TCPSocket based implementation of ServerRenderingPool for react-on-rails, with safe error handling and auto-reconnect

This is an implementation of ServerRenderingPool for react-on-rails that connects to NodeJS process over a TCP socket, instead of a UNIX socket.

The code handles socket disconnections, and attempts to reestablish connection to NodeJS server process in these cases. Also, if a connection-related exception was caught, it will not raise an exception in Rails server, but report it to Airbrake and return empty result - to let standard front-end code deal run its course.

The should be placed into an initializer (e.g. config/initializers/react_on_rails.rb), and its configuration block expanded with your usual configuration.

morhekil / i18n.js
Last active Aug 9, 2016
I grew frustrated trying to deal with FormatJS, react-intl et al, and wrote a simple wrapper around polyglot, numeral and moment js to localise a React app.
View i18n.js
// Simple i18n wrapper around polyglot, numeral and moment libraries:
// This is to achieve goals:
// 1. Have a locale message storage that can be decomposed into subsets,
// and passed down the dependency chain. Think providing a subset of locale
// strings to child components.
// 2. Centralise configuration, and normalise API of both moment and numeral
View morhl-request.xml
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="" xmlns:xsi="" xmlns="" xmlns:env="">
<env:Header><Operator xmlns=""><Login>rsp</Login><Password>xxx</Password></Operator></env:Header>
<GetCasinoHistoryRequest xmlns="">
You can’t perform that action at this time.