Skip to content

Instantly share code, notes, and snippets.

View dragneelfps's full-sized avatar
💻
Developer @ Expedia

Sourabh dragneelfps

💻
Developer @ Expedia
View GitHub Profile
@dragneelfps
dragneelfps / publishing.kt
Created March 29, 2020 08:01
Helper for publishing artifact to maven
fun Project.configurePublishing(artifactId: String, android: Boolean = false) {
var publishingExtension: PublishingExtension? = null
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
configure<PublishingExtension> {
publishingExtension = this
publications {
create<MavenPublication>("mavenRelease") {
this.artifactId = artifactId
if (android) {
@androidfred
androidfred / kotlin_arrow.md
Last active December 7, 2023 17:42
Kotlin Arrow

Kotlin Arrow

A lot of Kotlin features can be traced back to functional programming languages, eg

  • Heavy use of immutability-by-default and map, filter etc functions
  • Type inference
  • Data classes (which enable pattern matching)
  • Null safety and dealing with the absence of values

However, Kotlin is missing many incredibly useful data types that are ubiquitous in functional programming languages, eg Either, Try etc.

@dragneelfps
dragneelfps / GraphViews.java
Created January 19, 2018 18:13
Top, Bottom, Left and Right Views for a Graph
package graphs;
import java.util.*;
class Graph{
Node root = null;
Graph(){
}
static class Node{
int data;
Node left, right;
@fuglede
fuglede / tensorflow101.ipynb
Last active August 30, 2023 06:45
TensorFlow 101
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nstarke
nstarke / release-android-debuggable.md
Last active June 26, 2024 15:20
How to make a Release Android App debuggable

How to make a Release Android App debuggable

Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell and then run-as com.mypackage ( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs), but on a production release app downloaded from an app store you're most likely to see:

run-as: Package 'com.mypackage' is not debuggable
@adam-p
adam-p / Local PR test and merge.md
Last active February 5, 2024 19:39
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@AvatarQing
AvatarQing / AudioPlayer.java
Last active December 3, 2020 17:01
MediaPlayer播放音频封装类
package com.hk.agg.im.utils;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.os.PowerManager;
import android.text.TextUtils;