Skip to content

Instantly share code, notes, and snippets.

Thiago Filadelfo trfiladelfo

Block or report user

Report or block trfiladelfo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@trfiladelfo
trfiladelfo / Date.prototype.diff.js
Created Sep 2, 2019 — forked from netojoaobatista/Date.prototype.diff.js
Returns the difference between two Date objects.
View Date.prototype.diff.js
Object.defineProperty(Date.prototype,"diff",{
writable: false, configurable: false, enumerable: true,
/**
* Returns the difference between two Date objects.
* @param {Date} The date to compare to.
* @return {Object}
* @throws {TypeError}
*/
value: function(date) {
@trfiladelfo
trfiladelfo / SomeFragment.java
Created Aug 29, 2019 — forked from joshdholtz/SomeFragment.java
Android Google Maps V2 - MapView in XML
View SomeFragment.java
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@trfiladelfo
trfiladelfo / example.java
Created Aug 29, 2019
simulate click android
View example.java
view.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
Toast toast = Toast.makeText(
getApplicationContext(),
"View touched",
Toast.LENGTH_LONG
);
toast.show();
View NonSwipeableViewPager.java
public class NonSwipeableViewPager extends ViewPager {
public NonSwipeableViewPager(Context context) {
super(context);
}
public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@trfiladelfo
trfiladelfo / script.md
Created Jul 6, 2019
install postman in linux mint
View script.md

When it comes to API development, my weapon of choice for testing my code is Postman. I start using Postman since it's still a Chrome App. Now it encourages its user to use Postman Native app. I definitely love the idea, but all I can find is a download link without any installation document for Linux Mint.

So, here's what I did:

Download postman
$ wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz

Extract archive
$ sudo tar -xzf postman.tar.gz -C /opt
@trfiladelfo
trfiladelfo / install-docker.sh
Last active May 29, 2019 — forked from sethbergman/install-docker.sh
Install Docker CE on Linux Mint 19 / Ubuntu
View install-docker.sh
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get update
sudo apt-get install docker.io
# https://docs.docker.com/compose/install/
View UIImage+Resize.swift
//
// UIImage+Resize.swift
//
// Created by Marcos Griselli on 6/9/17.
// Copyright © 2017 Marcos Griselli. All rights reserved.
//
import Foundation
import UIKit
@trfiladelfo
trfiladelfo / multipart.swift
Created Mar 12, 2019 — forked from DejanEnspyra/multipart.swift
Alamofire 4 — Multipart file upload with Swift 3 (http://theappspace.com/multipart-file-upload/)
View multipart.swift
func requestWith(endUrl: String, imageData: Data?, parameters: [String : Any], onCompletion: ((JSON?) -> Void)? = nil, onError: ((Error?) -> Void)? = nil){
let url = "http://google.com" /* your API url */
let headers: HTTPHeaders = [
/* "Authorization": "your_access_token", in case you need authorization header */
"Content-type": "multipart/form-data"
]
Alamofire.upload(multipartFormData: { (multipartFormData) in
@trfiladelfo
trfiladelfo / RecyclerViewExtension.kt
Created Mar 5, 2019 — forked from arcadefire/RecyclerViewExtension.kt
Add addOnItemClickListener easily to a RecyclerView using Kotlin
View RecyclerViewExtension.kt
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {
@trfiladelfo
trfiladelfo / [1] main.js
Created Nov 3, 2018 — forked from hfalucas/[1] main.js
[Vue.js] Authentication and Authorization
View [1] main.js
/**
* Think of this "main.js" file as your application bootstrap.
*/
import Vue from 'vue'
import Resource from 'vue-resource'
import VueRouter from 'vue-router'
import routes from './routes'
import middleware from './middleware'
You can’t perform that action at this time.