Skip to content

Instantly share code, notes, and snippets.

View sunwicked's full-sized avatar
🏠
Working from home

sunny sunwicked

🏠
Working from home
View GitHub Profile
@gpeal
gpeal / FragmentA.kt
Last active October 2, 2024 04:10
View Binding Delegates
class WifiNetworksFragment : TonalFragment(R.layout.wifi_networks_fragment) {
// This automatically creates and clears the binding in a lifecycle-aware way.
private val binding: WifiNetworksFragmentBinding by viewBinding()
...
}
class WifiNetworkView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
1. Ask HN: What books changed the way you think about almost everything? - https://news.ycombinator.com/item?id=19087418
2. Ask HN: What are the best MOOCs you've taken? - https://news.ycombinator.com/item?id=16745042
3. Ask HN: How to self-learn electronics? - https://news.ycombinator.com/item?id=16775744
4. Ask HN: Successful one-person online businesses? - https://news.ycombinator.com/item?id=21332072
5. Ask HN: What's the most valuable thing you can learn in an hour? - https://news.ycombinator.com/item?id=21581361
@andreyryabtsev
andreyryabtsev / backmatting.ipynb
Last active June 5, 2024 04:56
BackMatting.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@interdigitize
interdigitize / createTrigger.js
Last active October 17, 2023 05:29
Scrape and save data to Google Sheets with Apps Script - create trigger
function createTrigger() {
// Trigger once a day
ScriptApp.newTrigger('getCovidDataAndUpdateSpreadSheet')
.timeBased()
.atHour(8)
.everyDays(1) // Frequency is required if you are using atHour() or nearMinute()
.create();
}
function getCovidDataAndUpdateSpreadSheet() {
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@aquaflamingo
aquaflamingo / deployApks.groovy
Last active May 13, 2019 18:25
Gradle task to archive APKs once built through android studio by running ./gradlew deployApks
task deployApks(type:Copy) {
description = "Copies APKs and Proguard mappings to the deploy directory"
def appName = "posture";
def versionDir = android.defaultConfig.versionName+"_"+android.defaultConfig.versionCode;
println("Copies APK and Proguard to " + versionDir)
from 'build/outputs/mapping/release/'
include '**/mapping.txt'
into '../.admin/deploy/' + versionDir

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@jlmcdonnell
jlmcdonnell / BetterActivityLifecycleCallbacks
Last active August 29, 2015 14:19
Android - Better Activity lifecycle callbacks
/**
* This class allows you to listen to when the user is entering the background (i.e. after a home button press,
* or opening recent apps etc) and when the user resumes the application from the background.
*
* @author John McDonnell
*/
public class BetterActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
private int mForegroundActivities;
@rharter
rharter / RevealDrawable.java
Created April 3, 2015 17:41
A Drawable that transitions between two child Drawables based on this Drawable's current level value. The idea here is that the center value (5000) will show the 'selected' Drawable, and any other value will show a transitional value between the 'selected' Drawable and the 'unselected' Drawable.
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.view.Gravity;
@donnfelker
donnfelker / CircularTransformation.java
Last active December 2, 2020 20:47
Picasso and CircularTransform Example
import android.graphics.*;
import com.squareup.picasso.Transformation;
/**
* Transforms an image into a circle representation. Such as a avatar.
*/
public class CircularTransformation implements Transformation
{
int radius = 10;