Skip to content

Instantly share code, notes, and snippets.

View c5inco's full-sized avatar

Chris Sinco c5inco

View GitHub Profile
@surajsau
surajsau / ParallaxScreen.kt
Last active April 16, 2024 13:53
Parallax effect with Jetpack Compose
@Composable
fun ParallaxScreen(modifier: Modifier = Modifier) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var data by remember { mutableStateOf<SensorData?>(null) }
DisposableEffect(Unit) {
val dataManager = SensorDataManager(context)
dataManager.init()
//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
@jongha
jongha / StringUtils.kt
Last active June 12, 2022 17:27
Remove trailing zeros in Kotlin
object StringUtils {
fun format(context: Context?, value: Float?): String? {
return trimZero(context?.resources?.getString(R.string.float_format, value ?: 0f))
}
fun format(context: Context?, value: Int?): String? {
return trimZero(context?.resources?.getString(R.string.int_format, value ?: 0))
}
fun trimTrailingZero(value: String?): String? {
@tahmidsadik
tahmidsadik / purgeAndroid.txt
Created September 19, 2015 18:47
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*

If you import live data into Google Docs spreadsheets using the importdata function and you want to force a refresh at a certain interval, but you also want to ensure that some cache-busting goes on, append a querystring that's the epoch time value that the refresh occurs, so for a sheet that should grab new data every hour you could force an update like this:

importData("http://example.com/data.csv?" & hour(googleclock()) & ")")

But the url requested looks like this: http://example.com/data.csv?11 if the refresh happened at 11am. The next day at 11, the url will be the same, so there's a chance you may get cached data. To get around this, use an epoch time-based refresh. The formula:

=((date(year(googleclock()),month(googleclock()),day(googleclock())) & " " & time(hour(googleclock()), 0, 0)) - DATE( 1970;1;1))*86400

gives you the epoch timestamp for the time at the current hour. If you wanted the timest

@hereswhatidid
hereswhatidid / web.config
Last active March 10, 2020 15:39
Web.config for enabling Roots WordPress theme URL rewrites
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Roots Rewrite CSS" stopProcessing="true">
<match url="^assets/css/(.*)" ignoreCase="false" />
<action type="Rewrite" url="/wp-content/themes/roots/assets/css/{R:1}" appendQueryString="true" />
</rule>
<rule name="Roots Rewrite JS" stopProcessing="true">