Skip to content

Instantly share code, notes, and snippets.

View afiqiqmal's full-sized avatar
👻
I may be slow to respond.

Hafiq afiqiqmal

👻
I may be slow to respond.
View GitHub Profile
@afiqiqmal
afiqiqmal / CircularRevealingFragment.java
Created October 29, 2017 11:13 — forked from ferdy182/CircularRevealingFragment.java
Make circular reveal animations on a fragment
/**
* Our demo fragment
*/
public static class CircularRevealingFragment extends Fragment {
OnFragmentTouched listener;
public CircularRevealingFragment() {
}
@afiqiqmal
afiqiqmal / Utils.php
Created November 1, 2017 16:49
This is a sample of renaming file in PHP
<?php
namespace App\Library;
use Carbon\Carbon;
class Utils
{
public static function getFile($file, $add_time = true, $replace_space = false)
{
@afiqiqmal
afiqiqmal / Message.php
Created November 1, 2017 16:51
This is a sample static class for returning json
<?php
namespace App\Library;
class Message
{
public static function error($msg = 'Something went wrong', $code = 400, $reference = null)
{
return response()->json(
[
@afiqiqmal
afiqiqmal / CronDecriptor.php
Created November 1, 2017 16:54
This is sample of cron descriptor which turn cron star into readable word
<?php
namespace App\Library;
// @codingStandardsIgnoreStart
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
@afiqiqmal
afiqiqmal / ErrorUtils.java
Created November 1, 2017 17:01
This is a sample class utils for handling errors message
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.crashlytics.android.Crashlytics;
import com.google.firebase.crash.FirebaseCrash;
import com.google.gson.Gson;
import com.iteractive.bepunct.R;
import com.iteractive.bepunct.client.Constant;
import com.iteractive.bepunct.client.entity.response.ErrorResponse;
@afiqiqmal
afiqiqmal / BlockPager.java
Created November 1, 2017 17:03
This is for to block swipe of viewpager
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* @author : hafiq on 07/02/2017.
*/
public class BlockPager extends ViewPager {
@afiqiqmal
afiqiqmal / SampleActivity.java
Created November 1, 2017 17:08
This code able to convert the whole view in scrollview to images. It been tested and successfully working.
@BindView(R.id.native_resit)
protected ScrollView native_resit;
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
....
....
@afiqiqmal
afiqiqmal / OnFragmentFinishLoad.java
Last active November 1, 2017 17:11
Android Viewpager Wait Fragment Finish Load. After several attempt on how to wait all the fragment in view pager is loaded, i came out a solution where i create interface class to communicate between activity and the fragment.
public interface OnFragmentFinishLoad {
public void onFinish(String tag,boolean state);
}
@afiqiqmal
afiqiqmal / FizzBuzz.java
Created November 1, 2017 17:14
FizzBuzz Problem
public static void main(String[] args){
for(int x=1;x<=100;x++){
if(x%3==0){
System.out.print("Fizz");
if(x%5==0){
System.out.print("Buzz");
}
@afiqiqmal
afiqiqmal / Bash alias
Created November 3, 2017 06:34 — forked from xmhafiz/Bash alias
Some lazy bash aliases
#laravel
alias pa="php artisan"
#git
alias gi="git init"
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gac="git add .;git commit -m"
alias gp="git push"