Skip to content

Instantly share code, notes, and snippets.

View dmfilipenko's full-sized avatar
💭
🧙‍♂️⚛️

Dmytro Filipenko dmfilipenko

💭
🧙‍♂️⚛️
View GitHub Profile
"""
1. «Sum of three numbers»
"""
a = int(input())
b = int(input())
c = int(input())
print(a + b + c)
"""
2. «Area of a right triangle»
#!/usr/bin/env bash
#
# Copyright (c) 2010-2014, Benjamin C. Meyer <ben@meyerhome.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#!/bin/sh
PASS=true
echo "\nElsint Javascript:\n"
npm run eslint
if [[ "$?" == 0 ]]; then
echo "\t\033[32mESLint Passed: $FILE\033[0m"
else
[1, true, false, 0, 0, null]
.filter(Boolean)
.map(function(value) {
return {
status: new Boolean(value),
date: new Date()
}
})
.forEach(function(obj) {
VendorsItems.insert(obj)
var flag = false
setTimeout(function(){
console.log('settimeout main')
}, 10000)
setTimeout(function(){
flag = true
}, 100)
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

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.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@dmfilipenko
dmfilipenko / gist:7569387
Last active December 28, 2015 22:09
Реализация конструктора $
Напишите конструктор $, который принимает аргументом DOM селектор.
Реализуйте методы width, height которые соответсвенно изменяют ширишу и высоту всех селекторов,
которые мы определили ранее.
Пример:
var $div = $('div')
console.log( $div ) //показать все div на странице.
var $red = $('.red')