Skip to content

Instantly share code, notes, and snippets.

import java.util.function.BiFunction;
public interface DeathToStrategy {
@FunctionalInterface
interface Strategy extends BiFunction<Integer, Integer, Integer>{}
static <T> void println(T arg) { System.out.println(arg); }
Strategy add = (a, b) -> a + b;
Strategy subtract = (a, b) -> a - b;
Strategy multiply = (a, b) -> a * b;
import classNames from 'classnames';
import domAlign from 'dom-align';
import React from "react";
import ReactDOM from "react-dom";
export interface PopoverProps {
target: HTMLElement | React.ReactInstance;
show: boolean;
placement: string;
children: React.ReactNode;
@jcdang
jcdang / test_sd.r
Created May 28, 2019 07:25
R's standard deviation is off
## Input data.
y = c(-0.25, 0.68, 0.94, 1.15, 1.20, 1.26, 1.26,
1.34, 1.38, 1.43, 1.49, 1.49, 1.55, 1.56,
1.58, 1.65, 1.69, 1.70, 1.76, 1.77, 1.81,
1.91, 1.94, 1.96, 1.99, 2.06, 2.09, 2.10,
2.14, 2.15, 2.23, 2.24, 2.26, 2.35, 2.37,
2.40, 2.47, 2.54, 2.62, 2.64, 2.90, 2.92,
2.92, 2.93, 3.21, 3.26, 3.30, 3.59, 3.68,
4.30, 4.64, 5.34, 5.42, 6.01)
@jcdang
jcdang / keepalive.sh
Last active August 29, 2019 19:54
clickhouse benchmark
#!/bin/bash
input="test.sql"
while IFS= read -r line
do
echo "${line}" | curl -sSg 'http://192.168.1.129:8123/?user=test&password=test' -d @-
done < "${input}"
@jcdang
jcdang / keepalive.py
Created August 29, 2019 20:36
Clickhouse benchmark for multiquery vs keep alive
import requests
s = requests.Session()
with open('test.sql') as fp:
for c, line in enumerate(fp):
s.post('http://10.240.0.79:8123/?user=test&password=test', line)
import 'package:flutter/material.dart';
class SizedColoredBox extends StatelessWidget {
final Color color;
final double width;
final double height;
final Widget? child;
const SizedColoredBox(
{Key? key,
@jcdang
jcdang / animated_transform.dart
Created February 25, 2022 23:28
Should go in flutter/lib/src/widgets/implicit_animations.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class AnimatedTransform extends ImplicitlyAnimatedWidget {
const AnimatedTransform({
Key? key,
this.child,
required this.transform,
this.alignment = Alignment.center,
this.filterQuality,