Skip to content

Instantly share code, notes, and snippets.

View dmitriid's full-sized avatar

Dmitrii 'Mamut' Dimandt dmitriid

View GitHub Profile
## This porvides your settings and Auth0 secrets
## It should read them from env, but I have them hardcoded in dev :D
defmodule Telepai.Secrets do
use AshAuthentication.Secret
def secret_for([:authentication, :strategies, :auth0, :client_id], Telepai.Users.User, _) do
{:ok, "2D...."} #get_config(:client_id)
end
@dmitriid
dmitriid / Makefile
Last active May 26, 2022 08:05
Makefile: webpack, babel, stylus, eslint
### Makefile to be used when compiling assets for Event Manager
### Based on ideas from https://github.com/acdlite/the-react-way/blob/master/Makefile
###
### Requirements/assumptions of this Makefile:
### JS
### - webpack (include json and css loaders to webpack cofig just in case)
### - babel
### - eslint (eslint-plugin-react if you want more lints of your react code)
### - eslint-watch (broken until 2.0.0: https://github.com/rizowski/eslint-watch/issues/8)
### CSS
scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]
(file|ftp|https|http|irc|mailto):\/\/((\w+(:\w+)?@)?\w(\w\.?)*(:\d{1,5})?\/?)?(\w(\w+\/)*)?(#\w+)?
---
scheme = (file|ftp|https|http|irc|mailto):\/\/
optional username followed by optional :password. Username and password ar alphanumeric
|

There's nothing great or particularly amazing about Angular and its build processes.

Everything Angular does is fighting against its own architectural decisions. On a high level it's like this:

  • We write in Typescript, we need to compile to Javascript
  • Typescript cannot compile our templates because they are custom templates
  • We need to compile templates
  • Typescript compiler barfs at some of our code, we need to fix the code, or the compiler, or both, or hack in between them
  • The resulting Javascript is hundreds of kilobytes larger than any competition.
  • We need to somehow reduce the size
const setUpClipboardHandler = (el) => {
let hasFiles = false;
let counter = 0;
const upload = (fileOrFiles) => {
let fileInput = null;
if (el.dataset.chunkId) {
fileInput = document.querySelector(`form[data-chunk-id="${el.dataset.chunkId}"] input[type="file"]`);
} else {
День уже почти прошел)) предлагаю сделать описание своего дня так, как это делал Лев Толстой 🤓😎🤪
Для начала прошу ознакомиться.
Из дневников Льва Толстого:
«1890 год, 4 июля. Встал поздно. Пью лишний кумыс».
«1889 год, 28 февраля. Встал рано, убрал комнату, записал, иду кофе пить. Объелся кофеем».
«1889 год, 14 ноября. Пошел работать и зашиб глаз».
«1889 год, 11 февраля. Пытался писать, не шло. Пошел в метель ходить».
«1889 год, 13, 14, 15, 16, 17 декабря. Утром хотел писать, но не очень и потому шил сапоги».
«1888 год, 5 декабря. Преступно спал».
«1884 год, 3 сентября. Ходил за грибами. Тосковал. Шил».
@dmitriid
dmitriid / svg-to-virtual-dom.js
Created September 11, 2015 10:30
Convert svg files to virtual-dom's VTree
/*
Convert svg files to virtual-dom's VTree
To use the resulting tree
import svg from 'virtual-dom/virtual-hyperscript/svg'
if you use Cycle.js:
import {svg} from '@cycle/dom';
*/
import fs from 'fs';
Delivered-To: <REDACTED>.com
Received: by 2002:a05:6214:82:0:0:0:0 with SMTP id n2csp3710665qvr;
Mon, 26 Nov 2018 09:51:22 -0800 (PST)
X-Google-Smtp-Source: AFSGD/VlrgF1kE9G29pn7VPXh6j+bRuznCSJ5cUlVYtXWykQFqK55qck9nUj3/wC2ImnipF6Znw3
X-Received: by 2002:a25:d44:: with SMTP id 65-v6mr28645754ybn.134.1543254682839;
Mon, 26 Nov 2018 09:51:22 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1543254682; cv=none;
d=google.com; s=arc-20160816;
b=kW2ozdsD7cDrF04BZ6k3mA50xcBqx5dnmsnjQHDmmQFjmC5BffeZ1/XdYc9HocxsIq
3/g5C5NQogthzBvLmNBF05OAuI3R5nzseoPEMnIUAATqfkDSkNiq3yPO5gq7+VaLs4UF
version: '3'
networks:
gaia:
driver: bridge
services:
# gaia-postgres:
# container_name: gaia-postgres
# image: postgres:latest
module.exports = {
devtool: 'source-map',
entry: ['./src/index.tsx'],
output: {
filename: 'bundle.js',
path: __dirname + '/dist/'
},
module: {
rules: [
{