Skip to content

Instantly share code, notes, and snippets.

type NativeType = null | number | string | boolean | symbol | Function;
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
function getDefault<P, K extends keyof P>(defaults: DefaultProps<P>, k: K, injected?: DefaultProps<P>): InferDefault<P, P[K]> | undefined {
return (p) => {
const t: InferDefault<P, P[K]> | undefined = (injected && k in injected) ? injected[k] : defaults[k]
if (typeof t === 'function') return t(p)
return t
}
}
@IARI
IARI / unitysonar-resharper.dockerfile
Created March 22, 2022 22:21
Sonar Scanner and Resharper Images based on unityci/editor
FROM iari/unitysonar:2020.3.25f1-android-mono46
ENV RESHARPER_VERSION="2021.1.5" \
RESHARPER_UNITY_VERSION="2021.1.2"
ENV RESHARPER_PATH=/opt/resharper \
RESHARPER_DOWNLOAD_URL="https://download-cdn.jetbrains.com/resharper/dotUltimate.${RESHARPER_VERSION}/JetBrains.ReSharper.CommandLineTools.${RESHARPER_VERSION}.zip" \
RESHARPER_UNITY_DOWNLOAD_URL="https://github.com/JetBrains/resharper-unity/releases/download/net211-rtm-$RESHARPER_UNITY_VERSION/JetBrains.Unity.$RESHARPER_UNITY_VERSION.127.nupkg"
RUN wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
@IARI
IARI / Brave Trial Stage 1 and hero setup
Created October 20, 2020 14:39
Bluestacks Scripts: Idle Heroes
#Brave Trial - Stage 1 + Hero setup
# Select Stage 1
tap 29,5 78 50
wait 300
tap 50 87 50
wait 300
# Set up Heroes
tap 26 88 50
wait 200
swipe 82 98 2 98 1200
wait 200
tap 11 45 50
wait 400
tap 86 19 50
wait 400
tap 84 58 50
wait 600
tap 50 82 50
wait 1000
import react.*
import react.dom.p
import react.dom.h3
import kotlinext.js.jsObject
import styled.styledDiv
val App = functionalComponent<RProps> {
errorBoundary {
p {
@IARI
IARI / build.gradle.kts
Last active March 28, 2019 18:12
Kotlin Gradle TornadoFX Boilerplate
val kotlinVersion = "1.3.21"
val mainClass = "com.example.demo.app.MyApp"
buildscript {
project.version = "0.1.0"
dependencies {
}
}
@IARI
IARI / AudioUtils.kt
Created March 15, 2019 23:32
get the length of a vorbis/ogg file
//4 bytes for "OggS", 2 unused bytes, 8 bytes for length
private const val OGG_OFFSET = 8 + 2 + 4
private val OGGS_BYTES = "OggS".map(Char::toByte).toByteArray()
private val VORBIS_BYTES = "vorbis".map(Char::toByte).toByteArray()
fun ByteArray.slice(start: Int, len: Int) = copyOfRange(start, start + len)
@Throws(IOException::class)
fun calculateOggDuration(oggFile: File): Pair<Int, Int> {
var rate = -1
var length = -1
@IARI
IARI / OS.kt
Created September 23, 2018 17:36
Operating system related tools
package com.julianjarecki.latextemplates.lib
import java.io.File
import java.util.logging.Logger
enum class OS {
Windows, OSX, Linux;
companion object {
val current: OS = System.getProperty("os.name")
package de.imc.placeholder.app
import com.github.h0tk3y.betterParse.lexer.*
import com.github.h0tk3y.betterParse.utils.cached
import java.io.InputStream
import java.util.*
import java.util.logging.Logger
import java.util.regex.MatchResult
import kotlin.coroutines.experimental.buildSequence
@IARI
IARI / nodes.py
Last active July 23, 2018 23:30
Test Blender PYthon Nodes
bl_info = {
'name': 'Node Test',
'category': 'User',
'author': 'Julian Jarecki',
'blender': (2, 79, 0),
# 'location': 'File > Export',
'description': "Test custom Nodes and sockets",
}
import bpy