This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(maybe_uninit_uninit_array)] | |
#![feature(extend_one)] | |
use std::mem::MaybeUninit; | |
fn main() { | |
let mut v = MyVec::new(); | |
v.push(Box::new(DropReporter)); | |
let mut dest = BadExtend(Default::default()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece, Mutability}; | |
use rustc_middle::{ | |
mir::{ | |
AggregateKind, AssertMessage, BasicBlock, BinOp, BorrowKind, CastKind, Coverage, | |
FakeReadCause, InlineAsmOperand, Local, NonDivergingIntrinsic, NullOp, Operand, Place, | |
RetagKind, Rvalue, StatementKind, SwitchTargets, TerminatorKind, UnOp, UserTypeProjection, | |
}, | |
ty::{Const, Region, Ty, Variance}, | |
}; | |
use rustc_span::Span; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
namespace RBC.WorkflowEngine.Core.Utilities; | |
/// <summary> | |
/// Provides a set of functions for parsing some of date- and time-related | |
/// data represented in ISO 8601 formats. | |
/// </summary> | |
/// <see href="https://en.wikipedia.org/wiki/ISO_8601"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
namespace Utilities | |
{ | |
public static class KotlinObjectExtensions | |
{ | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
public static T Also<T>(this T callee, Action<T> action) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.ui.text.AnnotatedString | |
import androidx.compose.ui.text.input.OffsetMapping | |
import androidx.compose.ui.text.input.TransformedText | |
import androidx.compose.ui.text.input.VisualTransformation | |
import java.text.DecimalFormat | |
import kotlin.math.min | |
class ThousandSeparatorVisualTransformation( | |
var maxFractionDigits: Int = Int.MAX_VALUE, | |
var minFractionDigits: Int = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
using System.Dynamic; | |
public class ObjectToInferredTypesConverter : JsonConverter<object> | |
{ | |
public override object Read( | |
ref Utf8JsonReader reader, | |
Type typeToConvert, | |
JsonSerializerOptions options) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numpy.random import choice | |
from numpy.linalg import norm | |
from scipy.stats import multivariate_normal | |
def train_gmm(data, k, convergence_threshold): | |
raw_data = data | |
data = pd.DataFrame(data) # Should be removed | |
feature_columns = data.columns | |
pis = np.ones((k, 1)) * 1 / k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.net.Uri | |
object GoogleAuthenticatorUtils { | |
enum class KeyType(val uriKey: String) { | |
TIME_BASED("totp"), | |
COUNTER_BASED("hotp") | |
} | |
//Based on https://github.com/google/google-authenticator/wiki/Key-Uri-Format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.graphics.Rect | |
import android.util.LayoutDirection | |
import android.view.View | |
import androidx.annotation.DimenRes | |
import androidx.recyclerview.widget.GridLayoutManager | |
import androidx.recyclerview.widget.RecyclerView | |
class MarginItemDecoration( | |
private val marginLeft: Int, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.util.AttributeSet | |
import androidx.constraintlayout.widget.Placeholder | |
// You can replace it with Placeholder when you want to set layout_constraintBaseline_toBaselineOf | |
class PlaceholderWithBaseline @JvmOverloads constructor( | |
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | |
) : Placeholder(context, attrs, defStyleAttr) { | |
override fun getBaseline(): Int = | |
content.baseline |
NewerOlder