Skip to content

Instantly share code, notes, and snippets.

View ufocoder's full-sized avatar
👽
🛸

Sergey ufocoder

👽
🛸
View GitHub Profile
@ufocoder
ufocoder / JavaScript.Magic.js
Last active June 4, 2024 16:13
JavaScript Magic
/*******************************************
*
* Javascript Magic Page
*
* Author: Sergey Ivanov <xufocoder@gmail.com>
*
* (\_/)
* (=':'=)
* ▀▀▀███████▀▀▀
* ███████
@ufocoder
ufocoder / MongoDB.Learn.md
Last active August 29, 2015 14:18
MongoDB Learn
@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 / 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()
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import Random
main =
Html.program
{ init = init
import Html exposing (Html)
import Time exposing (Time, second)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
@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 =
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)
const curry = (
f, arr = []
) => (...args) => (
a => a.length === f.length ?
f(...a) :
curry(f, a)
)([...arr, ...args]);