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 / SimpleTabLayout.java
Created May 29, 2018 22:49 — forked from faizsiddiqui/SimpleTabLayout.java
Android Sliding TabLayout with Icons.
package com.example.simpletablayout;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
@jesselima
jesselima / MainActivity.java
Created June 11, 2018 14:27
Get Android System Configuration Language.
package com.udacity.popularmovies;
import android.content.res.Resources;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
@jesselima
jesselima / MainActivity.java
Created June 12, 2018 02:20
Android System Locale and DisplayMetrics.
package com.udacity.popularmovies;
import android.content.res.Resources;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import java.util.Locale;
package com.udacity.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class ReuseOfToastObjectActivity extends AppCompatActivity {
@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
*/
@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 / 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 / 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 / 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 / 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