Skip to content

Instantly share code, notes, and snippets.

View lisovskyvlad's full-sized avatar

Lisovskii Vladislav lisovskyvlad

View GitHub Profile
top10Salaries :: FilePath -> IO ()
top10Salaries path = do
Just (h, t) <- uncons . T.lines <$> T.readFile path
let
split = T.splitOn ","
Just ind = elemIndex "Salary" $ split h
top10 :: [Int] = t
& map (\s -> read $ T.unpack $ split s !! ind)
& sortBy (flip compare)
& take 10
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 {
@kyleshevlin
kyleshevlin / memoizedHandlers.js
Created January 22, 2021 00:26
Using React.useMemo to create a `handlers` object
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.
@jferris
jferris / configmap.yaml
Last active February 8, 2024 14:15
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
import * as React from 'react';
import { useState } from 'react';
import { useHistory } from 'react-router-dom';
import useAsyncCallback from './useAsyncCallback';
export default function LoginPage() {
let history = useHistory();
return (
<article>
{/* какой-то контент, всё что угодно на странице логина */}
@darkleaf
darkleaf / question.md
Last active April 15, 2023 08:34
Algebraic effects для Clojure.

Привет!

Ключевые слова: coroutine, continuation, generators, async/await, project loom, free monad, algebraic effects.

Я хочу сделать алгебраические эффекты для Clojure(Script). Я уже сделал библиотеку https://github.com/darkleaf/effect/blob/doc-2/README.md Но есть моменты, которые вызывают у меня вопросы.

Если очень кратко, то лично мне эффекты нужны, чтобы:

  1. удобно тестировать бизнес логику
@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@yogthos
yogthos / clojure-beginner.md
Last active April 15, 2024 17:11
Clojure beginner resources

Introductory resources

{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Thomas Davis",
"label": "Web Developer",
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
"summary": "I'm a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am used to wearing many hats. I am a very product focused developer who prioritizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ",
"website": "https://lordajax.com",
@prepor
prepor / keybase.md
Last active November 26, 2018 10:47

Keybase proof

I hereby claim:

  • I am prepor on github.
  • I am prepor (https://keybase.io/prepor) on keybase.
  • I have a public key ASCAbQNQu9q1W0a75dB2O1UARIqBG9XPE2PnDwnXmXZB5wo

To claim this, I am signing this object: