Skip to content

Instantly share code, notes, and snippets.

View trfiladelfo's full-sized avatar

Thiago Filadelfo trfiladelfo

View GitHub Profile
@trfiladelfo
trfiladelfo / main.py
Created December 28, 2019 15:31
List all file (.mp3) in directory
path = "/Users/user/Music/"
files = [os.path.join(r, file) for r, d, f in os.walk(path)
for file in f if '.mp3' in file]
files.sort()
print(files)
@trfiladelfo
trfiladelfo / How to completely uninstall vscode on mac
Last active July 21, 2020 02:20
Backup all extensions install in VS Code
Here are all the places where VSCode stores stuff on Mac OS X, besides the Visual Studio Code.app itself, which is in your Applications folder:
rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist
rm -fr ~/Library/Caches/com.microsoft.VSCode
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -fr ~/Library/Application\ Support/Code/
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/.vscode/
Update (Feb 2020): There are potentially also hidden extension directories in your home directories. To get rid of everything make sure you look for those too. They start with .vscode-.
const puppeteer = require("puppeteer");
async function demo() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://arrayof.io");
await page.screenshot({ path: "screenshot.png" });
browser.close();
}
demo();
@trfiladelfo
trfiladelfo / Date.prototype.diff.js
Created September 2, 2019 18:20 — forked from netojoaobatista/Date.prototype.diff.js
Returns the difference between two Date objects.
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 August 29, 2019 16:08 — forked from joshdholtz/SomeFragment.java
Android Google Maps V2 - MapView in XML
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 August 29, 2019 16:05
simulate click android
view.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
Toast toast = Toast.makeText(
getApplicationContext(),
"View touched",
Toast.LENGTH_LONG
);
toast.show();
@trfiladelfo
trfiladelfo / NonSwipeableViewPager.java
Created July 12, 2019 14:55 — forked from ishitcno1/NonSwipeableViewPager.java
android non swipeable viewpager
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 July 6, 2019 17:28
install postman in linux mint

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 02:39 — forked from sethbergman/install-docker.sh
Install Docker CE on Linux Mint 19 / Ubuntu
#!/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/
@trfiladelfo
trfiladelfo / UIImage+Resize.swift
Created March 29, 2019 12:30 — forked from marcosgriselli/UIImage+Resize.swift
UIImage Resize/Scaling
//
// UIImage+Resize.swift
//
// Created by Marcos Griselli on 6/9/17.
// Copyright © 2017 Marcos Griselli. All rights reserved.
//
import Foundation
import UIKit