Skip to content

Instantly share code, notes, and snippets.

View a-x-'s full-sized avatar
🛩️

Alexander a-x-

🛩️
View GitHub Profile
@a-x-
a-x- / Flow.tsx
Last active July 21, 2020 14:26
Flexbox wrappper for React
import React, { ReactNode } from 'react';
import styled from 'styled-components';
/**
* Nice flexbox wrapper
* @example <Flow col size="1rem">...</Flow> // 1rem = 1unit = 8px
*/
interface Props {
children: ReactNode,
#
# RubyReactAdmin. ActiveAdmin like controller API, возвращающее TR-D json
# для отображения React-интерфейсе без js-кода для дефолтных сценариев
# с несложными кастомизациями фронта по необходимости лучшими фронтовыми технологиями
#
# todo: render_json, render_json_error, render_json_exception
# todo:
module Admin
@a-x-
a-x- / hypenate-huefikate-cyrillic-ru.js
Last active January 26, 2021 10:02
Хуификатор учитывающий почти все набросы из статьи https://alejo.livejournal.com/57859.html И тут же реализация алгоритма разбиения на слоги
/*
https://sites.google.com/site/foliantapp/project-updates/hyphenation
*/
function hypenate (word) {
return _substitute(Array.from(word).reduce((res, c) => {
return _substitute(res) + c;
}, ''));
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@a-x-
a-x- / index.html
Last active June 3, 2019 20:06
golang wasm. go <-> js interlop
<html>
<head>
<meta charset="utf-8">
<script src="wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then((result) => {
go.run(result.instance);
console.log(Template('123', "Цифры из этого смс никому нельзя сообщать. Для входа в приложение Рокетбанка введите код {{ index . 0 }}"));
@a-x-
a-x- / rm-initClass.js
Created February 9, 2019 20:29
rm initClass AST based post-processor for decaffeinate
#!/usr/bin/env node
// fixes the decaffeinate result: rm all the static initClass functions
// node scripts/coffee2es6jsx/rm-initClass.mjs files
// todo: rm Search.initClass();
const fs = require('fs');
const Glob = require('glob');
const parser = require("@babel/parser");
@a-x-
a-x- / stable-separation-sort.js
Last active November 16, 2018 18:51
Stable Separation Sort. Move items below and above the pivot
const arr = [
14418,
584,
1108,
1020,
363,
7073,
]
const max = Math.max(...arr)
@a-x-
a-x- / app-example.js
Last active November 13, 2018 11:08
react hooks on getters/setters — useStateObj
import React from "react";
import ReactDOM from "react-dom";
import useStateObj from "use-state-obj";
function App() {
var state = useStateObj({a:1})
function handleClick() {
++state.a
}
@a-x-
a-x- / interpose.coffee
Created November 9, 2018 13:27
interpose like join, but returns an array
# like join, but returns an array
interpose = (array, glue) ->
array.reduce (res,x) -> [].concat res, glue, x
export default interpose
@a-x-
a-x- / react-temporal-state.js
Last active July 17, 2018 18:16
react temporal state
// Временное выставление статуса
class Foo extends React.PureComponent {
// ...
foo () {
// ...
this.setState({
triggered: setTimeout(() => this.setState({ triggered: null }), 500)
})
}
componentWillUnmount () {