This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {open, read} = require('fs/promises'); | |
const {resolve} = require('path'); | |
async function main([filePath]) { | |
const resolvedPath = resolve(filePath); | |
let file; | |
try { | |
file = await open(resolvedPath); | |
} catch(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
type Key = 'foo' | 'bar'; | |
/** | |
* We must define an object type with an indexer that uses the same union type. | |
* Otherwise Flow will throw an error when we try accessing the value by a key | |
*/ | |
const titles: {[Key]: string} = { | |
foo: 'This is a foo', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React, {type ComponentType, type AbstractComponent} from 'react'; | |
//////////////////////////// | |
// A generic list component | |
//////////////////////////// | |
type ListProps<P> = {| | |
component: ComponentType<P>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a, | |
w=document.createTreeWalker(document,NodeFilter.SHOW_TEXT); | |
while(a=w.nextNode()){ | |
if(a.textContent.trim().length) { | |
a.textContent='Одиннадцатиклассница пошла посмотреть на достопримечательность, она шла долго, несколько строчек, пока не пришла'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql | |
sed -i -E 's/latin1/utf8/g' dump.sql | |
mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" | |
mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
320px | |
480px | |
600px | |
768px | |
900px | |
1200px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from here: http://habrahabr.ru/post/208684/ | |
function Gauss() { | |
var ready = false; | |
var second = 0.0; | |
this.next = function(mean, dev) { | |
mean = mean == undefined ? 0.0 : mean; // математичне очікування | |
dev = dev == undefined ? 1.0 : dev; // середньоквадратичне відхилення | |