Skip to content

Instantly share code, notes, and snippets.

View RinatMullayanov's full-sized avatar

Rinat Mullayanov RinatMullayanov

View GitHub Profile
/**
* Export all data from an IndexedDB database
*
* @param {IDBDatabase} idbDatabase The database to export from
* @return {Promise<string>}
*/
export function exportToJson(idbDatabase) {
return new Promise((resolve, reject) => {
const exportObject = {}
if (idbDatabase.objectStoreNames.length === 0) {
var R = require('ramda');
void 0; //to not bloat the output
var random = require('seed-random')(1337);
var data = [
{input: [0, 0], output: 0},
{input: [1, 0], output: 1},
{input: [0, 1], output: 1},
{input: [1, 1], output: 0},
];
var activation_sigmoid = x => 1 / (1 + Math.exp(-x));
@ALF-er
ALF-er / Opinion.md
Last active April 29, 2020 21:16
ReactJS Conf 2016

Disclaimer 1: Первую которая "про то чего мы достигли" я таки пропустил.

Disclaimer 2: Многие доклады смотрелись и отчёты писались в состоянии алкогольного опьянения.

Сейчас посмотрел Ben Alpert - What Lies Ahead она про то какие идеи они имеют о дальнейшем развитии. И они делят на UX-идеи и DX-идеи. В UX у них:

@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@andrey-str
andrey-str / ufw plexmediaserver app profile.md
Last active June 4, 2024 08:05
Plex Media Server UFW rule
[plexmediaserver]
title=Plex Media Server
description=The Plex Media Server is smart software that makes playing Movies, TV Shows and other media on your computer simple
ports=32400/tcp|1900/udp|32469/udp|5353/udp

Once you have defined your application file, put it in /etc/ufw/applications.d, then tell ufw to reload the application definitions with

ufw app update plexmediaserver
ufw app info plexmediaserver
@nanomen
nanomen / flexbox_materials.txt
Last active August 29, 2015 14:25
Материалы к докладу Flexbox - гибче мыслишь, больше спишь
# Материалы
- CSS Flexible Box Layout Module Level 1 - http://www.w3.org/TR/css-flexbox-1/
- Solved by Flexbox - http://philipwalton.github.io/solved-by-flexbox/
- Полное руководство по Flexbox - http://frontender.info/a-guide-to-flexbox/
- Строим с flexbox - http://habrahabr.ru/post/257253/
- Flexbox, теперь понятно - Вадим Макеев (2013) - https://vimeo.com/67011034
- Гибкие коробки на практике - Арсений Форштретер (2014) - https://events.yandex.ru/lib/talks/2231/
# Гифки для презентации http://www.thokamaer.com/
@vslinko
vslinko / 01_test.js
Last active August 29, 2015 14:22
es6 template literals example
import pgquery from 'pgquery'
const role = 'admin'
const likes = 5
console.log(pgquery`
SELECT * FROM users WHERE role = ${role} AND likes > ${likes}
`)
/*
{ queryString: '\n SELECT * FROM users WHERE role = $1::varchar AND likes > $2::int\n',
@shama
shama / electron-reliable-css-path.html
Created May 25, 2015 17:33
Alternate way to load CSS file to ensure it gets loaded with a correct path with Electron
<html>
<head>
<title></title>
</head>
<body>
Hi
<script>
var link = document.createElement('link')
link.setAttribute('rel', 'stylesheet')
link.setAttribute('href', require('path').join(__dirname, 'css', 'app.css'))
@RinatMullayanov
RinatMullayanov / native_promise_sample.js
Last active September 18, 2015 11:26
Notes about promises
function updateTask(oldTask, newTask) {
var promise = new Promise(function (resolve, reject) {
resolve({status: 'success'});
// resolve(Error('some error'));
});
return promise;
}
<div class="main">
<!--flex block-->
<div class="item">1 Lorem ipsum dolor sit amet, consecteur adipisicing elit. Excepturi repellat nisi ad soluta vitae velit similique consequatur aliquam, facere ea.</div>
<!--flex block-->
<div class="item">2 Lorem ipsum dolor sit amet, consecteur adipisicing elit. Excepturi repellat nisi ad soluta vitae velit similique consequatur aliquam, facere ea.</div>
<!--flex block-->
<div class="item">3 Lorem ipsum dolor sit amet, consecteur adipisicing elit. Excepturi repellat nisi ad soluta vitae velit similique consequatur aliquam, facere ea.</div>
<!--flex block-->
<div class="item">4 Lorem ipsum dolor sit amet, consecteur adipisicing elit. Excepturi repellat nisi ad soluta vitae velit similique consequatur aliquam, facere ea.</div>
<!--flex block-->