Skip to content

Instantly share code, notes, and snippets.

View ioxua's full-sized avatar
🎏
Existing

Yehoshua Oliveira ioxua

🎏
Existing
View GitHub Profile
@ioxua
ioxua / SmallDateFormat.java
Last active August 17, 2017 20:55
Format date according to the smallest measurement unit possible
HashMap<Long, String> formatacoes = new LinkedHashMap<>();
long segundo = 1000,
minuto = segundo * 60,
hora = minuto * 60,
dia = hora * 24,
semana = dia * 7,
mes = semana * 4,
ano = mes * 12;
formatacoes.put(ano, "{0,choice,1#1 year ago|1<{0} years ago}");
@ioxua
ioxua / PaddingItemDecoration.kt
Last active September 12, 2017 20:04
ItemDecoration for setting space around the RecyclerView items in Kotlin
import android.graphics.Rect
import android.support.v7.widget.RecyclerView
import android.view.View
class PaddingItemDecoration(val paddingTop: Int = 0,
val paddingRight: Int = 0,
val paddingBottom: Int = 0,
val paddingLeft: Int = 0,
val affectFirst: Boolean = true,
val affectEveryoneElse: Boolean = false,
@ioxua
ioxua / canvas-study.html
Last active December 31, 2017 16:00
Me and my grandness aspirations on creating game engines :D
<!DOCTYPE html>
<html>
<head>
<title>Testing Canvas</title>
<style>
canvas {
background-color: #ababab;
}
</style>
</head>
@ioxua
ioxua / activity_main.java
Last active September 30, 2022 15:02
Simple implementation of callback on Android Adapter
public class Activity extends AppCompatActivity implements MyAdapter.Callback {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_layout);
RecyclerView recycler = findViewById(R.id.recycler_view);
recycler.setAdapter(new MyAdapter(this));
}
@Override
public class Principal {
public static void main(String[] args) {
int[] vetor = new int[]{ 2, 7, 1, 12, 6, 4, 3, 5, 123, 0, -1, -123 };
boolean flg = true;
do{
int troca = 0;
flg = false;
<!DOCTYPE html>
<html>
<head>
<style>
.game { width: 800; height: 600; margin: 0 auto; }
</style>
</head>
<body>
<div class="game">
<canvas tabindex='1' id="gCanvas" width="800" height="600"></canvas>
(This is an example of a recursive factorial in Rockstar.)
(File extention is obviously made up.)
(I have put these wildcard variable names so you can come up...)
(...with your own creative names ;))
(I have just realized Rockstar has no multiline comments. Oops)
Factorial takes $NUM and $RES
If $NUM is smaller than $TWO
Give back $RES
@ioxua
ioxua / lib_aam.rs
Last active July 30, 2018 01:52
Article fetching engine start
// Abstract Article Model
#[derive(Debug)]
pub enum NodeKind {
// Should I use structs or tuples here?
Root, // Main node
Text(String),
Image {
src: String, alt: String, legend: String
},
Citation {
@ioxua
ioxua / PILHA.h
Last active September 13, 2018 23:13
Exercícios ED
// Do prof Fretz
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#define MAX 50
struct Pilha
{
int item[MAX];
@ioxua
ioxua / Inteirinha.java
Last active August 11, 2018 14:24
Érico's Subject
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;
public class Inteirinha {
static final int QUANTIDADE_DE_VALORES = 5;
public static void main(String ...args) {
Scanner ler = new Scanner(System.in);