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
<?php
namespace App\Console\Commands;
use Illuminate\Support\Str;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;
class ModelMakeCommand extends GeneratorCommand
{
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
@ar-android
ar-android / ControllerMakeCommand.php
Created April 2, 2018 15:45
Class for generating lumen controller
<?php
namespace App\Console\Commands;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;
class ControllerMakeCommand extends GeneratorCommand
{
/**
@ar-android
ar-android / ArrayRequest.java
Created January 22, 2018 10:43
Loop array images request body
MultipartBody.Builder builder = new MultipartBody.Builder();
MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png");
int i = 0;
for (Image imageData : listImage) {
builder.addFormDataPart("uploaded_file" + "["+ i +"]", imageData.getName(), RequestBody.create(MEDIA_TYPE_PNG, new File(imageData.getPath())));
i++
}
@ar-android
ar-android / Share.java
Created January 20, 2018 14:09
Android intent Share
public static void share(Activity activity){
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Download \n" + activity.getString(R.string.app_name) +
"\nhttps://play.google.com/store/apps/details?id=" + activity.getPackageName());
sendIntent.setType("text/plain");
activity.startActivity(sendIntent);
}
@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 / CheckUpdate.java
Created January 6, 2018 17:50
CheckUpdate.java
private void checkUpdate() {
FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
long cacheExpiration = 3600;
@ar-android
ar-android / frebsd_laravel_install.md
Last active November 1, 2024 22:30
Setup FreeBSD Server for Laravel

Update Package

sudo freebsd-update fetch install

Install NGINX

sudo pkg install nginx
@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

Install PHP and Nginx

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install nginx php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-soap php7.1-tidy php7.1-dev php7.1-intl php7.1-gd php7.1-curl php7.1-zip php7.1-xml php7.1-xdebug

Install MYSQL

sudo apt-get install mysql-server