Skip to content

Instantly share code, notes, and snippets.

View paulocoutinhox's full-sized avatar

Paulo Coutinho paulocoutinhox

View GitHub Profile
@paulocoutinhox
paulocoutinhox / AppDelegate.swift
Last active October 7, 2023 17:39
iOS - Código para rodar sem Main.Storyboard
@UIApplicationMain //or @main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window?.rootViewController = RootViewController()
window?.makeKeyAndVisible()
return true
@paulocoutinhox
paulocoutinhox / WebServer.java
Created July 19, 2023 03:29
Java NanoHTTP WebServer
package server;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import fi.iki.elonen.NanoHTTPD;
public class WebServer extends NanoHTTPD {
@paulocoutinhox
paulocoutinhox / mobile-tools-opinion.md
Last active February 10, 2022 06:55
Minha opinião sobre o uso de ferramentas para a criação rápida de aplicações mobile

Sempre que me perguntam sobre o uso do Flutter, React Native, Xamarin e Native Script para o desenvolvimento de aplicativos, eu sempre respondo mostrando como elas funcionam.

O meu desafio aqui é conseguir explicar como todo o universo mobile funciona e também cada uma dessas ferramentas em um pequeno post sem entrar em termos técnicos (me ajuda Jesus).

A principal coisa que você precisa entender sobre essas ferramentas é que elas não sobrevivem sozinhas e que são DEPENDENTES das plataformas nativas da Apple e do Google. Na prática, o que você tem no final é um pacote que vai embarcado numa aplicação padrão gerada na hora que você cria o projeto com essas ferramentas.

Vou usar o Flutter como exemplo, pois já fiz alguns cursos e tenho dois aplicativos reais feitos com ele (Avinu e iMinerator).

O Flutter nada mais é que um framework open source do Google que cria um projeto para Android e iOS onde ao compilar seu código Dart ele o embarca no projeto nativo criado para o Android Studio e Xcode, como se

#include <iostream>
#include <memory>
using namespace std;
class Renderer
{
public:
int xyz = 99;
git checkout --orphan newBranch
git add -A
git commit -am "clean repository"
git branch -D main
git branch -m main
git push -f origin main
git gc --aggressive --prune=all
@paulocoutinhox
paulocoutinhox / delete-workflow-run.sh
Last active November 13, 2021 03:30
Delete All Github Runs From Workflow
# Requirements: Github Client (gh) and JQ tool (jq)
# 1 - Change: OWNER, REPO
# 2 - Execute one time to get all workflows IDs
# 3 - Change: WORKFLOW_ID
OWNER=<your user/org name>
REPO=<repo name>
# list workflows
@paulocoutinhox
paulocoutinhox / compiling_building_c_cpp_notes.md
Created August 2, 2021 23:37 — forked from gubatron/compiling_building_c_cpp_notes.md
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015; August 29, 2019.

Include Paths

On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found.

With gcc and llvm include paths are passed with -I/path/to/includes, you can pass as many -I as you need.

In Windows, cl.exe takes include paths with the following syntax: /I"c:\path\to\includes\ you can also pass as many as you need.

/**
* Returns true when [Context] is unavailable or is about to become unavailable
*/
fun Context?.isDoomed(): Boolean = when (this) {
null -> true
is Application -> false
is Activity -> (this.isDestroyed or this.isFinishing)
else -> false
}
fun test1(callback: (() -> Unit)? = null) {
callback?.let {
it()
}
}
fun test2(callback: () -> Unit?) {
callback()
}