Skip to content

Instantly share code, notes, and snippets.

View KChernenko's full-sized avatar
🎯
Focusing

Constantine Chernenko KChernenko

🎯
Focusing
View GitHub Profile
@McPo
McPo / Oculus Quest Unity OSX Integration Patch
Last active February 6, 2022 12:17
Enable Oculus Quest Unity Development on OSX / macOS via `Oculus > OVR Build`
1. Install the embedded Android SDK and copy the file `adb` to `adb.exe` e.g:
```
cd /Applications/Unity/Hub/Editor/****/PlaybackEngines/AndroidPlayer/SDK/platform-tools/
cp adb adb.exe
```
2. Apply the following diff to the Oculus Integration asset.
3. Navigate to Oculus > OVR Build > OVR Scene Quick Preview
@dvf
dvf / change-codec.md
Last active May 21, 2024 16:48
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@objcode
objcode / ConcurrencyHelpers.kt
Last active May 2, 2024 08:05
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@mzgreen
mzgreen / SizeHelper.kt
Last active February 13, 2021 15:23
A ConstraintHelper implementation that has additional layout params: screenHeight_percent and screenWidth_percent which allow to make referenced views height and width to be equal to screenHeight(or screenWidth)*some_percent_value. Where some_percent_value is a value between 0.0 and 1.0.
class SizeHelper @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintHelper(context, attrs, defStyleAttr) {
private val screenHeight: Int = resources.displayMetrics.heightPixels
private val screenWidth: Int = resources.displayMetrics.widthPixels
private var layoutConstraintScreenHeightPercent = UNSPECIFIED_CONSTRAINT_SCREEN_PERCENT
@chazcheadle
chazcheadle / config.go
Created June 7, 2017 04:32
Golang Viper config read into struct
package main
import (
"fmt"
"github.com/spf13/viper"
)
// Create private data struct to hold config options.
type config struct {
@nickbutcher
nickbutcher / MainActivity.java
Last active August 20, 2021 16:15
A quick sample of the new physics-based animation library added in Support Library 25.3.0 docs: https://developer.android.com/reference/android/support/animation/package-summary.html output: https://twitter.com/crafty/status/842055117323026432
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@JosiasSena
JosiasSena / DeCryptor.java
Last active September 12, 2023 12:40
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@Kraiden
Kraiden / BetterBounceInterpolator.java
Last active December 30, 2020 03:31
A more configurable bounce interpolator for Android animations
import android.view.animation.Interpolator;
import static java.lang.Math.*;
public class BetterBounceInterpolator implements Interpolator {
private int mBounces;
private double mEnergy;
/** Have more control over how to bounce your values.
*
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LightingColorFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;