Skip to content

Instantly share code, notes, and snippets.

View floatdrop's full-sized avatar
🐒

Vsevolod Strukchinsky floatdrop

🐒
View GitHub Profile
@floatdrop
floatdrop / Validation.kt
Last active August 6, 2022 17:08
Konform proposal
package io.konform.validation
import com.quickbirdstudios.nonEmptyCollection.list.NonEmptyList
import com.quickbirdstudios.nonEmptyCollection.unsafe.toNonEmptyList
import kotlin.reflect.KProperty1
class Validation<T, E>(private val block: ValidationBuilder<T, E>.(T) -> Unit) : Validator<T, E> {
override operator fun invoke(
value: T,
builder: ValidationBuilder<T, E>
In file included from /Users/floatdrop/xtensor-benchmark/src/main.cpp:13:
/Users/floatdrop/xtensor-benchmark/src/benchmark_1D.hpp:61:46: error: no member named 'raw_data' in 'xt::xtensor_container<xt::uvector<double,
xsimd::aligned_allocator<double, 32> >, 1, xt::layout_type::row_major, xt::xtensor_expression_tag>'
benchmark::DoNotOptimize(res.raw_data());
~~~ ^
In file included from /Users/floatdrop/xtensor-benchmark/src/main.cpp:14:
/Users/floatdrop/xtensor-benchmark/src/benchmark_2D.hpp:56:42: error: no member named 'raw_data' in 'xt::xtensor_container<xt::uvector<double,
xsimd::aligned_allocator<double, 32> >, 2, xt::layout_type::row_major, xt::xtensor_expression_tag>'
benchmark::DoNotOptimize(res.raw_data());
~~~ ^
// matcha bench.js
var objectAssign = require('./');
var assert = require('assert');
bench('simple', function () {
assert.deepEqual(objectAssign({foo: 0}, {bar: 1}, {bar: 2}), {foo: 0, bar: 2});
assert.deepEqual(objectAssign({}, {}, {foo: 1}), {foo: 1});
assert.deepEqual(objectAssign({foo: 0}, {bar: 1}), {foo: 0, bar: 1});
assert.deepEqual(objectAssign({foo: 0}, null, undefined), {foo: 0});
57628	browserify/node_modules/browserify-zlib/node_modules/pako/lib/zlib/deflate.js
46367	browserify/node_modules/browserify-zlib/node_modules/pako/lib/zlib/inflate.js
39267	browserify/node_modules/buffer/index.js
38588	browserify/node_modules/browserify-zlib/node_modules/pako/lib/zlib/trees.js
25381	browserify/node_modules/readable-stream/lib/_stream_readable.js
25381	got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_readable.js
25381	got/node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js
22257	browserify/node_modules/url/url.js
16593	browserify/node_modules/browserify-zlib/src/index.js
var koa = require('koa');
var app = koa();
var backend = require('./backend');
var router = require('koa-router')();
router.get('/todo/', function *(next) {
var sid = yield backend.sessid();
this.body = yield {
sessid: sid,
@floatdrop
floatdrop / app.js
Last active August 29, 2015 14:24
Refactoring Tools!
// Disclaimer: пример намеренно упрощен
var app = express();
app.get('/user/:id', function (req, res, next) {
if (req.params.id === '31337') {
res.send('Hello eleet!');
return;
}
@floatdrop
floatdrop / bench.js
Created June 17, 2015 06:17
Compare split performance
// npm i matcha -g
// matcha bench.js
bench('a', function() {
'a'.split('.');
});
bench('a.b', function() {
'a.b'.split('.');
});
@floatdrop
floatdrop / bench.js
Created June 14, 2015 10:46
Matcha benchmark for dot-prop
// npm i matcha -g
// matcha bench.js
var dotProp = require('./');
var testObject = {
a: {
b: {
c: {
d: {
var B = require('b_');
var Array_of = function (any) {
return Array.prototype.slice.call(any);
};
B.with = function () {
var b = this,
curriedArgs = Array_of(arguments);
❯ gulp watch:src
[21:53:09] Using gulpfile ~/test/gulpfile.js
[21:53:09] Starting 'watch:src'...
[21:53:09] Finished 'watch:src' after 14 ms
[21:53:09] Starting 'styles:src'...
[21:53:09] Finished 'styles:src' after 27 ms
[21:53:15] index.less was changed
[21:53:15] Starting 'styles:src'...
[21:53:15] Finished 'styles:src' after 8.76 ms
[21:53:18] index.less was changed