Skip to content

Instantly share code, notes, and snippets.

View infernalmaster's full-sized avatar
😻
Working from home

Rostyslav Diachok infernalmaster

😻
Working from home
View GitHub Profile
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
Object in js works as hash table
new String('x'). Vs String('x'). Vs 'x'.
Boxing, unboxing - прості типи загортаються в об’єкти якщо у них викликати метод, а потім назад розгортаються. Наприклад 'asdf'.toUpperCase()
(https://github.com/getify/You-Dont-Know-JS/blob/master/types%20&%20grammar/ch4.md)
typeof new String('x')
{x: 1} !== {x: 1}
Матеріали
http://dmitrysoshnikov.com/
ECMA-262-3 in detail
ECMA-262-5 in detail
http://dmitrysoshnikov.com/ecmascript/es5-chapter-3-2-lexical-environments-ecmascript-implementation/
https://habr.com/company/ruvds/blog/422089/
http://www.ecma-international.org/ecma-262/6.0/
Візуалізатор виконання коду
-# /app/views/layouts/barbajs.html.haml
!!!
%html
%head
%title= yield(:title)
%body
.barba-container
= yield
# /app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :disbale_layout_if_barbajs
# no sense to send all layout, just a part with barba content
def disbale_layout_if_barbajs
if request.headers['x-barba'].present?
@keyframes pageIn {
from {
opacity: 0;
visibility: visible;
}
to {
opacity: 1;
}
}
// /app/javascript/packs/application.js
import Barba from 'barba.js'
import {HideShowTransition, FadeTransition} from '../barbaTransitions'
/**
*
* @param {Element} conatainerElement
*/
function initAll(conatainerElement) {
// initialize all js scripts inside conatainerElement
-# /app/views/layouts/application.html.haml
!!!
%html{lang: I18n.locale}
%head
%meta{content: "text/html; charset=UTF-8", "http-equi": "Content-Type"}
= csrf_meta_tags
%meta{charset: "utf-8"}
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}
= stylesheet_link_tag 'application', media: 'all'
%body
@infernalmaster
infernalmaster / stream.js
Created September 1, 2018 15:42
simple stream implementation
console.log('start')
function stream() {
const mapFunctions = []
const createStream = function (val) {
if (val !== null) {
mapFunctions.forEach(mapFunction => mapFunction(val))
}