Skip to content

Instantly share code, notes, and snippets.

View lucas-marciano's full-sized avatar
🎯
Coding

Lucas Marciano lucas-marciano

🎯
Coding
View GitHub Profile
[versions]
com-android-application = "8.1.0-alpha11"
org-jetbrains-kotlin-android = "1.7.20"
core-ktx = "1.9.0"
junit = "4.13.2"
androidx-test-ext-junit = "1.1.3"
espresso-core = "3.4.0"
lifecycle-runtime-ktx = "2.3.1"
activity-compose = "1.5.1"
compose-bom = "2022.10.00"
import kotlin.io.*;
/*
Verify whether a long text is following the order rule defined in order string. For example the order string is "abcd", which means "a" can't appear at any position after "b", "c" and "d" in the text, "b" can't appear at any position after "c" and "d" in the text and "c" can't appear at any position after "d" in the text. if the text is "axubbxcxxdx", then the text didn't follow the rule, since "b" appears after "c" in substring "cxb"
a : 1
x : 11
b : 8
c : 7
@lucas-marciano
lucas-marciano / ExempleRemeber.kt
Created July 5, 2022 20:36
Exemplo do uso do remember com elevação do controle de estado
@Composable
fun HelloScreen() {
var name by rememberSaveable { mutableStateOf("") }
HelloContent(name = name, onNameChange = { name = it })
}
@Composable
fun HelloContent(name: String, onNameChange: (String) -> Unit) {
Column(modifier = Modifier.padding(16.dp)) {
@lucas-marciano
lucas-marciano / MainActivity.kt
Created July 1, 2022 15:54
Simple Compose exemple
import androidx.compose.runtime.Composable
class TodoActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val datainfo = DataInfo("Lucas", "lucas.m@email.com")
setContent {
MyTheme {
Surface {
@lucas-marciano
lucas-marciano / gist:f4e56465da0bcf790d5818eb0ce02efd
Created August 3, 2021 19:22
Minhas alias/configurações do git
[alias]
# Change and update local master branch
m = !git checkout master && git pull && git fecth -p
# Change and update local develop branch
d = !git checkout develop && git pull && git fecth -p
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
TypeError: Cannot read property 'trim' of undefined
1 anonymous
/Users/lucasmarciano/Documents/Projetos/personal/adonisjs/test-backend/node_modules/@adonisjs/fold/src/Registrar/index.js:104
2 arrayMap
/Users/lucasmarciano/Documents/Projetos/personal/adonisjs/test-backend/node_modules/lodash/lodash.js:639
3 Function.map
<?php
class MyUserClass
{
public function getUserList()
{
$dbconn = new DatabaseConnection('localhost','user','password');
if ($dbconn->connect_error) {
// Supondo que a classe DatabaseConnection tenha tratado as funções de erro no banco
die("Conexão falhou: " . $dbconn->connect_error);
$dbconn->close();
<?
/*Codigo original*/
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
header("Location: http://www.google.com");
exit();
} elseif (isset($_COOKIE['Loggedin']) && $_COOKIE['Loggedin'] == true) {
header("Location: http://www.google.com");
exit();
}
?>
<?php
for ($i = 1; $i <= 100; $i++){
if(divisorCinco($i) && divisorTres($i)){
echo "<p>FizzBuzz</p>";
}elseif (divisorCinco($i)){
echo "<p>Buzz</p>";
}elseif(divisorTres($i)){
echo "<p>Fizz</p>";
}else{
echo "<p>{$i}</p>";
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.inthecheesefactory.lab.databinding.MainActivity">