Skip to content

Instantly share code, notes, and snippets.

View jeovazero's full-sized avatar
:octocat:
lamentavel

jeovazero

:octocat:
lamentavel
  • JOI/SC
View GitHub Profile
let
config = {
packageOverrides = p: {
sbt = p.sbt.override {
jre = p.jdk11;
};
scala = p.scala.override {
jre = p.jdk11;
};
};
// https://www.inf.ufpr.br/nicolui/grad/Programas/Curiosidades/Gerador-CPF/Algoritmo-CNPJ.txt
function validateDigit(cnpjValues: number[], extraDigit?: number) {
const values = extraDigit != null ? [...cnpjValues, extraDigit] : cnpjValues
let size = values.length
let position = size - 7
let sum = 0
for (let i = 0; i < size; i++) {
sum += values[i] * position--
/* author: jeovazero */
/**
* Linking by size + Path halving
*/
class UnionFind(size: Int) {
val roots = IntArray(size)
val sizes = IntArray(size)
var rootsSize = size - 1
init {
for(i in 0..(size - 1)) {

Install

$ nix-env -f '<nixpkgs>' -iA nix-direnv direnv

Configure

Add to $HOME/.direnvrc:

source $HOME/.nix-profile/share/nix-direnv/direnvrc
# linear_regression
# 2021-06-06
# author: jeovazero
Σ = sum
h(t, x) = Σ(t .* x)
j(θ, x, y) = 1 / 2 * Σ([(h(θ, x[i]) - y[i])^2 for i in 1:length(y)])
bool isEven(int num) {
return num % 2 == 0;
}
bool isEven(int num) => num % 2 == 0;
/// replicateText(text: 'go', times: 2) == 'gogo'
/// replicateText(times: 0, text: 'go') == ''
String replicateText({ String text, int times }) {
var result = '';
// jeotario's academy
Future foo() {
print('start');
return Future.delayed(Duration(seconds: 2), () async {
print('end');
});
}
Future<String> fallen() {
// jeotario's academy
void exceptional() {
throw Exception('hi');
}
void hello() {
throw 'Hello Friend';
}
// jeotario's academy
enum Team { SkGaming, Furia, MiBr, Liquid, GodSent }
void infoTeam(Team team) {
switch(team) {
case Team.MiBr:
case Team.Furia:
case Team.GodSent:
print('Time cheio de brasileiros');
// jeotario's academy
class Player {
String name;
int age;
Player(this.name, this.age);
}
class Org {
String name;