Skip to content

Instantly share code, notes, and snippets.

View ar-android's full-sized avatar
:octocat:
NULL

Ahmad Rosid ar-android

:octocat:
NULL
View GitHub Profile
@ar-android
ar-android / frebsd_laravel_install.md
Last active December 27, 2023 19:07
Setup FreeBSD Server for Laravel

Update Package

sudo freebsd-update fetch install

Install NGINX

sudo pkg install nginx
@ar-android
ar-android / Api.java
Created November 10, 2016 16:59
OkHttp With RxAndroid and RxJava
public static Observable<Response> getData() {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
final OkHttpClient client = new OkHttpClient();
final Request request = new Request.Builder()
.url("https://github.com/ar-android/panfic/raw/master/Panfic/gen/com/ocit/data.json")
.get()
.addHeader("cache-control", "no-cache")
@ar-android
ar-android / currency
Last active September 23, 2023 07:57
set currency EditText
private void setCurrency(final EditText edt) {
edt.addTextChangedListener(new TextWatcher() {
private String current = "";
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
@ar-android
ar-android / UriToBitmap.java
Created January 3, 2016 14:14
Convert uri to Bitmap
public Bitmap getThumbnail(Uri uri) throws FileNotFoundException, IOException {
InputStream input = this.getContentResolver().openInputStream(uri);
BitmapFactory.Options onlyBoundsOptions = new BitmapFactory.Options();
onlyBoundsOptions.inJustDecodeBounds = true;
onlyBoundsOptions.inDither=true;//optional
onlyBoundsOptions.inPreferredConfig=Bitmap.Config.ARGB_8888;//optional
BitmapFactory.decodeStream(input, null, onlyBoundsOptions);
input.close();
@ar-android
ar-android / Window.java
Created May 15, 2019 15:24
LWJGL Window Object
package engine;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.opengl.GL;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.GL_TRUE;
import static org.lwjgl.opengl.GL11.glClearColor;
import static org.lwjgl.system.MemoryUtil.NULL;
@ar-android
ar-android / ShowHideFab.java
Created January 19, 2018 18:14
Show and Hide Floating Action Button when scrolling recyclerview
// Java
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0 && fab.getVisibility() == View.VISIBLE) {
fab.hide();
} else if (dy < 0 && fab.getVisibility() != View.VISIBLE) {
fab.show();
@ar-android
ar-android / Download.php
Created July 7, 2017 07:13
Download file using guzzle
<?php
class Download {
public function download($url, $name, $extensions){
$path = __DIR__.'/download/' . $name . $extensions;
$file_path = fopen($path,'w');
$client = new \GuzzleHttp\Client();
$response = $client->get($url, ['save_to' => $file_path]);
return ['response_code'=>$response->getStatusCode(), 'name' => $name];
}
@ar-android
ar-android / default
Created February 9, 2017 13:56 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@ar-android
ar-android / RxBus.java
Created February 13, 2017 08:18 — forked from vuhung3990/RxBus.java
Rxjava 2 Bus
/**
* for send object between fragment, activity, service...
* REMEMBER: dispose if not in use to avoid leak memory
*/
public class RxBus<T> {
private static final String PREFIX = "$^%)@";
private static RxBus instance;
private PublishSubject<BusMessage<T>> subject = PublishSubject.create();
@ar-android
ar-android / alat-tempur-YouTube.md
Last active December 9, 2019 06:55
Alat tempur YouTube

Alat Perang Pemain Youtube

Kumpulan Alat Perang untuk para pemain Youtube gratis. Mari berusaha untuk mengurangi penggunaan produk bajakan semaksimal mungkin!

Desktop Tools

Kumpulan alat & bahan yang dieksekusi lewat desktop.

  1. GIMP2 - https://gimp.org Untuk editing gambar, cover channel, foto profil, thumbnail & background cover (pengganti photoshop)

  2. Inkspace - https://inkscape.org