Skip to content

Instantly share code, notes, and snippets.

View ufocoder's full-sized avatar
👽
🛸

Sergey ufocoder

👽
🛸
View GitHub Profile
@ufocoder
ufocoder / example.js
Last active September 12, 2018 10:53
getLastResolvedPromise
import getLastResolvedPromise from './getLastResolvedPromise'
const promise1 = Promise.resolve(3);
const promise2 = new Promise(function(resolve, reject) {
setTimeout(resolve, 200, 'foo');
});
const promise3 = new Promise(function(resolve, reject) {
setTimeout(resolve, 100, 'bar');
});
@ufocoder
ufocoder / js-task-1.md
Created June 25, 2018 13:47 — forked from codedokode/js-task-1.md
Задания на яваскрипт (простые)
const curry = (
f, arr = []
) => (...args) => (
a => a.length === f.length ?
f(...a) :
curry(f, a)
)([...arr, ...args]);
module Main exposing (..)
import Collage exposing (Form, collage, filled, move, rect)
import Color exposing (Color, rgb)
import Element exposing (toHtml)
import Html exposing (Html)
import Keyboard
import Mouse
import Random
import Time exposing (Time, millisecond)
@ufocoder
ufocoder / tasks.elm
Created April 8, 2018 12:38
elm.tasks.elm
-- Tuple
("oh", ("my", (42, "god"))) -- touch the God
(("Hello", 100), ("World", 200)) -- need "Hello World 300"
((((((("Boom has been planted"))))))) -- tuple?
-- Record
myRecord =
import Html exposing (Html)
import Time exposing (Time, second)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import Random
main =
Html.program
{ init = init
@ufocoder
ufocoder / helpers.js
Last active October 20, 2017 21:55
Roman Number array creation
module.exports = {
createArray: (begin, end) => {
const result = []
for (let i = begin; i<end+1; i++){
result.push(i)
}
return result
},
fromRoman: (_str) => {
var str = _str.toString()
@ufocoder
ufocoder / slim-redux.js
Created June 20, 2016 11:39 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@ufocoder
ufocoder / MongoDB.Learn.md
Last active August 29, 2015 14:18
MongoDB Learn