Skip to content

Instantly share code, notes, and snippets.

View ChathuraHettiarachchi's full-sized avatar
📡
Looking for new things...

Choota ChathuraHettiarachchi

📡
Looking for new things...
View GitHub Profile
@ChathuraHettiarachchi
ChathuraHettiarachchi / MotionLayoutTry.kt
Last active April 15, 2024 05:36
This is a sample implementation of AirBnB search bar transition on Android usin Jetpack Compose MotionLayout, MotionScene with DSL. You need to replace the images on `destinations` to work this. FInd the video link https://twitter.com/i/status/1778640663086829622
package com.chootadev.composetryout
import androidx.annotation.DrawableRes
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@ChathuraHettiarachchi
ChathuraHettiarachchi / SpringRing.kt
Last active April 8, 2024 00:35
I found an awesome SwiftUI implementation on SpringRings Ui which made me try out it with Jetpack compose Cavas API. Find the video on https://www.linkedin.com/posts/chathurajh_jetpackcompose-canvasapi-activity-7182898304748326914-liw4?utm_source=share&utm_medium=member_desktop
package com.choota.dev.composetryout
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
@ChathuraHettiarachchi
ChathuraHettiarachchi / Script.rb
Created May 31, 2019 08:41
XCode download script
#!/usr/bin/env ruby
print "What is the URL of your Apple Downloads resource?\nURL:"
url = gets.strip
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: "
token = gets.strip
command = "aria2c --header \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\" --header \"Upgrade-Insecure-Requests: 1\" --header \"Cookie: ADCDownloadAuth=#{token}\" --header \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1\" --header \"Accept-Language: en-us\" -x 16 -s 16 #{url} -d ~/Downloads"
@ChathuraHettiarachchi
ChathuraHettiarachchi / yt-list-to-mp3
Created December 17, 2018 08:22 — forked from davidefavia/yt-list-to-mp3
Convert YouTube playlist to mp3
#!/bin/bash
clear;
echo "Insert YouTube playlist ID: ";
read playlistId;
# You need youtube-dl to use this script: http://youtube-dl.org/
youtube-dl --extract-audio --audio-format mp3 --yes-playlist https://www.youtube.com/watch?list=$playlistId -i
@ChathuraHettiarachchi
ChathuraHettiarachchi / .rubocop.yml
Created October 17, 2018 05:51 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@ChathuraHettiarachchi
ChathuraHettiarachchi / WGS84Converter.java
Last active August 3, 2018 13:36
The World Geodetic System (WGS) is a standard for use in cartography, geodesy, and satellite navigation including GPS. It comprises a standard coordinate system for the Earth, a standard spheroidal reference surface (the datum or reference ellipsoid) for raw altitude data, and a gravitational equipotential surface (the geoid) that defines the no…
import java.lang.Math;
public class WGS84Converter{
// how to call methods
// int[] dataXY = convertLatLonToWGS84(-94.420307, 44.968046);
// System.out.println("DataXY: X="+dataXY[0]+" Y="+dataXY[1]);
// double[] dataLonLat = convertWGS84ToLatLon(dataXY[0], dataXY[1]);
// System.out.println("DataLotLan: X="+dataLonLat[0]+" Y="+dataLonLat[1]);
### Keybase proof
I hereby claim:
* I am chathurahettiarachchi on github.
* I am chathurah (https://keybase.io/chathurah) on keybase.
* I have a public key ASBswZFul7L4JNYIbPylMPa6O7BfrrakX5PULvIXIGlzvQo
To claim this, I am signing this object:
@ChathuraHettiarachchi
ChathuraHettiarachchi / ThousandSeparatorWatcher.java
Created December 19, 2017 05:10
This is a simple text watcher to resolve "How to set thousands separator in Android?" quiz.
package com.chootdev.myapplication;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.widget.EditText;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;