Skip to content

Instantly share code, notes, and snippets.

View WeRockStar's full-sized avatar

Kotchaphan Muangsan WeRockStar

View GitHub Profile
@WeRockStar
WeRockStar / gist:168a851645190cd723987414a9042e06
Created September 21, 2018 14:31 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@WeRockStar
WeRockStar / CleanArchitecture.md
Created September 1, 2018 05:32 — forked from ygrenzinger/CleanArchitecture.md
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@WeRockStar
WeRockStar / README.md
Created August 31, 2018 12:57 — forked from lopspower/README.md
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo

@WeRockStar
WeRockStar / build.gradle
Created August 31, 2018 08:49 — forked from maheshwarLigade/build.gradle
Example of use from Proguard, from Android Studio
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
@WeRockStar
WeRockStar / proguard-rules.pro
Created August 31, 2018 08:49 — forked from nisrulz/proguard-rules.pro
Android : Proguard Rules for a Library Module
#
# This ProGuard configuration file illustrates how to process a program
# library, such that it remains usable as a library.
# Usage:
# java -jar proguard.jar @library.pro
#
# Save the obfuscation mapping to a file, so we can de-obfuscate any stack
# traces later on. Keep a fixed source file attribute and all line number
# tables to get line numbers in the stack traces.
class UserActivity : AppCompatActivity(), UserPresenter.View {
@Inject lateinit var presenter: UserPresenter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
(application as ModernApp).component.inject(this)
presenter.attachView(this)
@WeRockStar
WeRockStar / ModernAndroidDevelopmentPart1.kt
Last active March 4, 2018 01:32
Code snippet for Modern Android Development Class
class UserActivity : AppCompatActivity() {
@Inject lateinit var api: SimpleApi
@Inject lateinit var threadService: RxThread
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
@WeRockStar
WeRockStar / GitHub-Forking.md
Created August 20, 2017 14:31 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@WeRockStar
WeRockStar / TopCropImageView.java
Created September 13, 2016 07:59 — forked from arriolac/TopCropImageView.java
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.