Skip to content

Instantly share code, notes, and snippets.

View README.md

I'm using this program to improve my skills in different languages

How

All of the diacritic characters(czech, slovak, etc languages) are replaced with their analogues from the latin abc. š -> s; ě -> e So you don't have to worry about perfect character matching.

Usage

perl learn-languages.pl some-path.txt some-other-path/file.txt

Mine files are written in the following format

View blockchain.rb
require 'digest'
class Block
attr_reader :index, :hash
def initialize(index:, timestamp: Time.now, data:, previous_hash:)
@data = data
@index = index
@timestamp = timestamp
@previous_hash = previous_hash
@artemgurzhii
artemgurzhii / index.js
Last active Dec 24, 2017
JS dynamic Code Splitting
View index.js
import {
Router
} from './helpers/router/lib';
const router = new Router({
mode: 'history',
root: '/'
});
router
@artemgurzhii
artemgurzhii / README.md
Last active Nov 14, 2018
Intersection Observer API usage example on LazyLoadImages
View README.md
View application.js
import DateHelper from './modules/dateHelper';
const dataInit = new DateHelper();
const _timeAgoElems = document.querySelectorAll('.time-ago-in-words');
[..._timeAgoElems].forEach(elem => {
const time = elem.querySelector('time');
time.textContent = dataInit.timeAgoInWords(time.dataset.time);
});
@artemgurzhii
artemgurzhii / math.c
Last active Nov 23, 2016
Recreation of native CLang log() and pow() functions which works with decimals.
View math.c
#include <stdio.h>
#include <math.h>
#define MYLOG_N 12
#define MTPOW_N 30
#define EXP_VAL 2.718281828459045090795598298427648842334747314453125
double cfrac_log(double x, unsigned int n) {
if (x < 0) {
return NAN;
View EventEmitter.js
class EventEmitter {
constructor() {
this.events = {};
}
on(event, func) {
if(this.events[event]) {
this.events[event].push(func);
} else {
this.events[event] = [func];
@artemgurzhii
artemgurzhii / xhr.js
Last active Nov 18, 2016
Promise XMLHttpRequest function
View xhr.js
function XHR(url) {
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest();
request.open('GET', url, true);
request.send(null);
request.addEventListener('readystatechange', () => {
if (request.status === 200) {
if (request.readyState === 4) {
resolve(JSON.parse(request.response));
}