Skip to content

Instantly share code, notes, and snippets.

View jose-almir's full-sized avatar

José Almir jose-almir

View GitHub Profile
def splitparts(string_seq, parts):
"""
Args:
string_seq(str): sequências em string, como "ARARA", "VOO", "AVES".
parts(int): critério para quebrar a sequência em string
Returns:
Retorna a lista dividida de acordo com o critério parts, veja
exemplos:
1) splitparts("ARARA", 2) -> ["AR", "AR", "A"]
@jose-almir
jose-almir / refresh4me.py
Last active January 29, 2020 15:56
A over engine that reloads the web page whenever your files change, useful for web dev
"""
HOW TO USE =>
1. DOWNLOAD FIREFOX DRIVE: GECKODRIVER
2. INSTALL SELENIUM AND WATCHDOG LIBS
3. USE PYTHON3
4. SPECIFY MAIN HTML FILE FOR RELOAD WHENEVER THE PATH CHANGES
5. SPECIFY THE PATH OF YOUR PROJECT
ENJOY
@jose-almir
jose-almir / simple_singleton.dart
Created April 2, 2020 11:59
A simple singleton in dart
class Singleton {
static Singleton _instance = Singleton.internal();
Singleton.internal();
factory Singleton(){
return _instance;
}
static get instance => _instance;
@jose-almir
jose-almir / tic_tac_toe.html
Created October 5, 2020 18:58
Tic Tac Toe game with HTML/JS
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TicTacToe</title>
<style>
body {
margin: 0;
@jose-almir
jose-almir / flexbox_form.html
Created October 8, 2020 19:24
Fancy login form with FlexBox.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LOGIN FORMS WITH FLEXBOX</title>
<style>
body {
height: 100vh;
margin: 0;
@jose-almir
jose-almir / navbar_responsive.html
Created October 8, 2020 19:29
Your custom and responsive navbar with burger.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navbar Reponsive and Fixed without Frameworks</title>
<style>
body {
margin: 0;
@jose-almir
jose-almir / either.kt
Last active December 1, 2020 17:50
Simple Either implementation in Kotlin with fold method
sealed class Either<L, R> {
inline fun <B> fold(onLeft: (L) -> B, onRight: (R) -> B): B = when (this) {
is Left -> onLeft(this.value)
is Right -> onRight(this.value)
}
operator fun not() = fold(::id, ::id)
}
class Left<L, R>(val value: L) : Either<L, R>()
@jose-almir
jose-almir / ktexec.sh
Last active December 1, 2020 17:48
ktexec - compile and optionally executes Kotlin file.
#!/bin/bash
###############################################################
# Script Name : ktexec #
# Description : Compile and optionally executes Kotlin File #
# Args : KOTLIN-FILE [-x] #
# Author : José Almir #
# Email : jrcodev@gmail.com #
###############################################################
@jose-almir
jose-almir / ts-crash-course.ts
Created December 17, 2020 01:25
TypeScript Fast Crash Course Annotations
// TypeScript Fast Crash Course Annotations
// Type inference
const car = {
brand: 'BMW',
engine: '3.4',
run: () => {
console.log(`Running ${car.brand}`);
}
};
@jose-almir
jose-almir / wave.dart
Last active May 4, 2021 17:53
Wave (Sample 01)
import 'dart:math';
import 'dart:typed_data';
import 'package:flutter/material.dart';
const amp = 20.0;
const freq = 1 / 150;
final mirrorX = Float64List.fromList([
1, 0, 0, 0,