Skip to content

Instantly share code, notes, and snippets.

View phileo's full-sized avatar

Phileo phileo

View GitHub Profile
@KlassenKonstantin
KlassenKonstantin / ClippedForeground.kt
Last active May 7, 2024 10:35
evervault.com inspired animation
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.nativeCanvas
@Composable
@Raiden18
Raiden18 / Button.kt
Last active March 23, 2023 15:51
Button.kt More complex example with polymorphism
sealed class ButtonSize(
open val heightDpInt: Int,
open val color: Color,
open val textResId: Int
) {
object Small : ButtonSize(16, Color.Red, R.string.small_button_text)
object Medium : ButtonSize(24, Color.Gray, R.string.medium_button_text)
object Large : ButtonSize(32, Color.Green, R.string.large_button_text)
object Huge : ButtonSize(40, Color.Blue, R.string.huge_button_text)
data class Custom(
package com.techyourchance.multithreading.demonstrations.purecoroutines
import android.util.Log
import com.techyourchance.multithreading.DefaultConfiguration
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import java.util.concurrent.atomic.AtomicInteger
class ProducerConsumerCoroutinesOnlyBenchmark {
On the criteria to be used in decomposing systems into modules – David Parnas
http://sunnyday.mit.edu/16.355/parnas-criteria.html
A Note On Distributed Computing – Jim Waldo, Geoff Wyant, Ann Wollrath, Sam Kendall
http://web.cs.wpi.edu/~cs3013/a11/Papers/Waldo_NoteOnDistributedComputing.pdf
The Next 700 Programming Languages – P. J. Landin
http://thecorememory.com/Next_700.pdf
Can Programming Be Liberated from the von Neumann Style? – John Backus
@medvedev
medvedev / build.gradle
Last active October 23, 2023 16:56
Gradle task that prints total dependencies size and (dependency+(size in kb)) list sorted by size desc
...
/* Tested with Gradle 6.3 */
tasks.register("depsize") {
description = 'Prints dependencies for "default" configuration'
doLast() {
listConfigurationDependencies(configurations.default)
}
}
@Ozius
Ozius / GetBitmapDescriptor.java
Last active October 25, 2023 00:46
Get BitmapDescriptor from a VectorDrawable resource for use as an icon on a Google Map Marker. Google Maps SDK for Android.
/*
mMap.addMarker(new MarkerOptions()
.position(new LatLng(latitude, longitude))
.title("Marker Title")
.snippet("Marker snippet")
.icon(getBitmapDescriptor(R.drawable.ic_place_black_48dp)));
*/
private BitmapDescriptor getBitmapDescriptor(int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
import android.annotation.TargetApi;
import android.nfc.Tag;
import android.nfc.tech.IsoDep;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
@alex-shpak
alex-shpak / Interceptor.java
Last active June 14, 2024 02:40
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@lukeredpath
lukeredpath / jetbrains.teamcity.BuildAgent.plist
Created November 14, 2012 17:22
Launcher for TeamCity OSX Build Agent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WorkingDirectory</key>
<string>/Users/teamcity/TeamCity/buildAgent</string>
<key>Debug</key>
<false/>
<key>Label</key>
<string>jetbrains.teamcity.BuildAgent</string>
@oodavid
oodavid / README.md
Last active October 11, 2024 00:36 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/