Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Lisovskii Vladislav lisovskyvlad

View GitHub Profile
View promise_playground.js
const f = (wait_count, string) => (
new Promise((res, rej) => (setTimeout(() => res(string), wait_count)))
);
async function sequence() {
const a = await Promise.all([
f(2000, '2000 wait'),
f(500, '500 wait'),
f(1000, '1000 wait')
]);
View titanic.json
{
"Title": "Titanic",
"Year": "1997",
"Rated": "PG-13",
"Released": "19 Dec 1997",
"Runtime": "194 min",
"Genre": "Drama, Romance",
"Director": "James Cameron",
"Writer": "James Cameron",
"Actors": "Leonardo DiCaprio, Kate Winslet, Billy Zane, Kathy Bates",
View lein__profiles.clj
{:user {:plugins [[lein-cljfmt "0.6.1"]]
:dependencies [[lein-light-nrepl "0.3.3"]]
:repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]}}}
@lisovskyvlad
lisovskyvlad / middle_rate.rb
Last active Jul 29, 2018
Ruby solution for the task mentioned in the article http://grishaev.me/why-clj
View middle_rate.rb
class MiddleRate
attr_reader :data
def initialize(data)
@data = data
end
def call
# age rates got { 18 => [30, 15], 50 => [35] }
age_rates = data.each_with_object(memory_hash) do |data_item, acc|
View Dockerfile
FROM starefossen/ruby-node:2-8
LABEL maintainer="Lisovskii Vladislav (a@a.de)"
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
ENV APP_HOME /sw-app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
View gitlab_output.txt
Running with gitlab-ci-multi-runner 9.5.1 (96b34cc)
on ci_runner_02 (bcf9d6e9)
Using Docker executor with image ruby:2.4.3 ...
Starting service postgres:latest ...
Pulling docker image postgres:latest ...
Using docker image postgres:latest ID=sha256:ec61d13c85666651ff092b89d46ae958d81c7f3d387ed91ae5c530a38b9896e2 for postgres service...
Waiting for services to be up and running...
Using docker image sha256:b8b3cb280f3e2b76afb91d3c7c3227bac6de27e9f27e7ace2d9dd533b9c92309 for predefined container...
Pulling docker image ruby:2.4.3 ...
Using docker image ruby:2.4.3 ID=sha256:713da53688a6446953cb7c0260d03a65a115cb60b727a890142628a4622642c7 for build container...
View gitlab-ci.yml
image: ruby:2.4.3
stages:
- test
services:
- postgres:latest
variables:
POSTGRES_DB: sw-test-db
View tries.rb
class Trie
Node = Struct.new(:char, :children, :is_complete_word)
attr_reader :root
def initialize
@root = Node.new('', {}, false)
end
def add_word(word)
@lisovskyvlad
lisovskyvlad / download-url-to-file.rb
Created Feb 29, 2016 — forked from johnjohndoe/download-url-to-file.rb
Ruby script to download a number of files from individual URLs via HTTP/HTTPS/FTP specified in an external file.
View download-url-to-file.rb
#!/usr/bin/env ruby
#
# Ruby script to download a number of files
# from individual URLs via HTTP/HTTPS/FTP
# specified in an external file.
#
# Author: Tobias Preuss
# Revision: 2013-04-18 16:26 +0100 UTC
# License: Creative Commons Attribution-ShareAlike 3.0 Unported
@lisovskyvlad
lisovskyvlad / Dockerfile
Created Dec 22, 2015
Good example of dockerfile for ruby in drone.
View Dockerfile
FROM ruby:2.2
RUN gem update --system && gem install bundler
RUN sed -i 's/deb http:\/\/httpredir.debian.org\/debian jessie main/deb http:\/\/httpredir.debian.org\/debian jessie main non-free/' /etc/apt/sources.list
RUN sed -i 's/deb http:\/\/security.debian.org jessie\/updates main/deb http:\/\/security.debian.org jessie\/updates main non-free/' /etc/apt/sources.list
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && apt-get install -y nodejs unrar && npm install -g phantomjs
You can’t perform that action at this time.