Skip to content

Instantly share code, notes, and snippets.

@kaievns
kaievns / unused.js
Created January 23, 2018 01:56
Finds unused react components in a project
const { execSync } = require('child_process');
const directory = 'src';
const findOut = execSync('find -L src').toString();
const filenames = findOut.trim().split('\n')
.filter(name => name.endsWith('.js'))
.map(name => name.replace('.js', '').replace('src/', '').replace(/\/index$/, ''));
console.log('Found', filenames.length, 'files in', directory);
@kaievns
kaievns / notes.md
Last active January 26, 2018 08:19
Apollo GraphQL experience notes
  1. Overall sense of instability. Considering that there are basically two grown up implementations for react out there Relay and Apollo. Seing issues like those in apollo make me feel uneasy. References: apollographql/react-apollo#1286 apollographql/react-apollo#556 https://github.com/apollographql/apollo-test-utils/issues/39

there are multiple variations of each throught the apollo related packages. the most disturbing is lack of response or sense of community ownership. it gives an impression of one guy manning half of the leverages

let solution = 'a'...'z'; // <- the end solution;
let currentSolution = 'z'...'a';
while (grade(currrentSolution) < '100%') {
let generation = randomlyMutate(currentSolution, { times: 10 });
let bestInGeneration = pickBestSolutionIn(generation);
currentSolution = bestInGeneration;
}
/- kicks in the process
+--------+
HTTP -> | kicker |
+--------+
|
V /- tracks generations
+--------+
*--->| looper |
| +--------+
| |
import { Form } from 'forms-kit'
import { ValidationError } from 'a-plus-forms'
const OurForm = ({ onSubmit, defaultValues }) => {
<Form onSubmit, dfeaul>
...
}
@kaievns
kaievns / fake_math.c
Last active October 26, 2024 05:26
Fake math.h substitute for embedded systems to calculate sin/cos values
/**
* A super simple sin/cos substitute based on taylor sequences
* to avoid importing the math.h
*
* sin x = x - x^3/3! + x^5/5! -x^7/7! ...
* cos x = 1 -x^2/2!+x^4/4!-x^6/6! ...
*/
// #include "math.h"
// #include <zephyr/kernel.h>