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 / console-example.php
Created May 25, 2018 15:26 — forked from sallar/console-example.php
PHP Colored CLI Output Script.
<?php
// Output screenshot:
// http://cl.ly/NsqF
// -------------------------------------------------------
include_once 'console.php';
// ::log method usage
// -------------------------------------------------------
Console::log('Im Red!', 'red');
@ar-android
ar-android / tip.md
Last active April 8, 2018 02:34 — forked from devdrops/tip.md
Restart PHP-FPM 7.1 on Mac

Restart PHP-FPM on Mac

as found on StackOverflow

And this command to restart my php-fpm:

brew services restart php71
@ar-android
ar-android / README-Template.md
Created November 3, 2017 08:29 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ar-android
ar-android / EndlessRecyclerOnScrollListener.java
Created March 13, 2017 18:58 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@ar-android
ar-android / gist:1b1ef871d2a330876ef0d1a2ed79d480
Created February 13, 2017 12:22 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@ar-android
ar-android / FRP iOS Learning resources.md
Created February 13, 2017 12:04 — forked from JaviLorbada/FRP iOS Learning resources.md
The best FRP iOS resources.

Videos

// WEEK
Calendar first = Calendar.getInstance();
first.add(Calendar.DAY_OF_WEEK, first.getFirstDayOfWeek() - first.get(Calendar.DAY_OF_WEEK));
int startWeek = first.get(Calendar.DATE);
int endWeek = startWeek + 6;
// MONTH
// start = 1
Calendar date = Calendar.getInstance();
@ar-android
ar-android / BackgroundUploader.java
Created February 13, 2017 08:53 — forked from vuhung3990/BackgroundUploader.java
background upload with progress
package com.grasys.shortupload.helper;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
/**
* convert milisec to hh:MM:ss
* @param millisUntilFinished
* @return String time
*/
public static String convertMilisecToHMmSs(long millisUntilFinished) {
return String.format("%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(millisUntilFinished),
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) - TimeUnit.HOURS.toMinutes(
TimeUnit.MILLISECONDS.toHours(millisUntilFinished)),