Skip to content

Instantly share code, notes, and snippets.

View jesselima's full-sized avatar
📱
Coding for mobile...

Jesse Lima jesselima

📱
Coding for mobile...
View GitHub Profile
@jesselima
jesselima / AutoFitGridLayoutManager.java
Created August 7, 2018 17:16
/* AutoFitGridLayoutManager * * AUTHORING: * Created by anupamchugh on 05/03/17. * Source code from BY ANUPAM CHUGH. * Article published on APRIL 2, 2018 on * https://www.journaldev.com/13792/android-gridlayoutmanager-example */
package com.journaldev.recyclerviewgridlayoutmanager;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
/**AUTHORING:
* Created by anupamchugh on 05/03/17.
* Source code from BY ANUPAM CHUGH.
* Article published on APRIL 2, 2018 on
@jesselima
jesselima / CustomItemClickListener.java
Created August 3, 2018 12:20 — forked from riyazMuhammad/CustomItemClickListener.java
Easy Implementation of RecyclerView custom onItemClickListener
public interface CustomItemClickListener {
public void onItemClick(View v, int position);
}
@jesselima
jesselima / MyLifecycleActivity.java
Created August 3, 2018 00:21
MyLifecycleActivity PlayGround. Run the activity, start application, play with stack and destroy application watching the Logcat.
package com.udacity.myapplicationtest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
/**
* Official documentation:
* https://developer.android.com/reference/android/app/Activity
*/
@jesselima
jesselima / Angular-6-cli-snippets.md
Last active July 31, 2018 13:56
Usefull commands for Angular CLI 6+

NOTE: You must have Angular CLI 6+

These commands were used under the following environment:

Angular CLI: 6.1.1

Node: 8.9.4

OS: linux x64

Angular: 6.1.0

@jesselima
jesselima / NetworkCodeSnipets.java
Created July 17, 2018 16:58
Android Network Code Snipets
/**
* When a item list is clicked the news item will be shown on the device browser.
*
* @param url is Web Url of the news item.
*/
private void openWebPage(String url) {
Uri uriWebPage = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uriWebPage);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
@jesselima
jesselima / EpochDate.java
Created July 3, 2018 12:02
Get unix current DATETIME
// Get unix current DATETIME
long epoch = System.currentTimeMillis()/1000;
Log.v(">>EPOCH NOW DATE>>>", String.valueOf(epoch));
@jesselima
jesselima / MySQL.sql
Last active June 30, 2018 18:14
MySQL simple code snipets
-- TIME STAMP SAMPLE FOR NEW ROWS and UPDATE A EXISTING ROW
create table table_name (
id int unsigned not null auto_increment,
column_abc varchar(255) not null,
column_created timestamp not null default current_timestamp,
column_updated timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
);
@jesselima
jesselima / Git and Github tips.md
Last active August 10, 2018 01:48
Git and Github tips

Create a new local branch and checkout on it:

$ git checkout -b <name_of_your_new_branch>

List all branches:

$ git branch

Push all local branches to Github

git push --all origin

@jesselima
jesselima / upgrade_node_version.md
Last active June 26, 2018 23:59
Upgrade node version and npm

Upgrade node version using nvm and reinstall global packages from the previous version.

nvm install x.xx.x --reinstall-packages-from=y.y.y

x.xx.x stands for the new version

y.y.y stands for the old version

Update npm:

npm i -g npm

@jesselima
jesselima / MyLifecycleActivity.java
Created June 19, 2018 13:20
Learn about Activity lifecycle. Play with the app watching logcat to see the logs. Comments from offcicial documentation (https://developer.android.com/reference/android/app/Activity).
package com.udacity.myapplicationtest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
/**
* Official documentation:
* https://developer.android.com/reference/android/app/Activity
*/