Skip to content

Instantly share code, notes, and snippets.

View gabrieljmj's full-sized avatar
💻
Working from home

Gabriel Jacinto gabrieljmj

💻
Working from home
  • Zig
  • Itajobi, SP, Brazil
View GitHub Profile
@gabrieljmj
gabrieljmj / AbstractRuleSet.php
Created November 19, 2019 17:39
LaravelRuleSets
<?php
namespace App\Rules\RuleSets;
use InvalidArgumentException;
abstract class AbstractRuleSet implements RuleSet
{
/**
* Rules set to combines with.
const isFunction = value => value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
function setTexts({ vars, target, all }) {
all = all || false
for (let varName in vars) {
if (all || vars[varName].set || isFunction(vars[varName].value)) {
console.log('Updating elements for \'' + varName + '\'a')
Array.from(target.querySelectorAll('*[data-text="' + varName + '"]')).forEach(el => {
@gabrieljmj
gabrieljmj / curriculum.md
Last active March 9, 2022 19:41
Curriculum Vitae

Curriculum Vitae

Gabriel Força Jacinto, 23 anos
Desenvolvedor Web
Itajobi, São Paulo
(17) 99623-8089
gamjj74@hotmail.com

Resumo

Venho desde meus 12 anos estudando tecnologias relacionadas à web (cerca de 8 anos). Tenho como principal foco o desenvolvimento principalmente com as linguagens PHP (Orientação a Objetos) e JavaScript. A área mobile também me atrai atualmente, principalmente utilizando React Native.

@gabrieljmj
gabrieljmj / array_compare.js
Created January 18, 2016 22:31
compare arrays
Array.prototype.isEqual = function (arr) {
if (arr.length != this.length || !(arr instanceof Array)) return false;
for (let k = 0, len = this.length; k < len; k++) {
if (this[k] instanceof Array && arr[k] instanceof Array) {
if (!this[k].isEqual(arr[k])) return false;
} else {
if (arr[k] !== this[k]) return false;
}
}
@gabrieljmj
gabrieljmj / oo.php
Last active December 30, 2015 21:25
PHP OO
<?php
class PhpOo
{
public function __call($name, array $args)
{
$cUFA = $this->getName('callUserFuncArray');
return $cUFA($this->getName($name), $args);
}
@gabrieljmj
gabrieljmj / .html
Last active October 28, 2015 01:59
Copy to clipboard without clipboard.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<textarea>:) this is a fuckin' text</textarea>
<button>Copy</button>
<script src="main.js"></script>
@gabrieljmj
gabrieljmj / factorial.js
Created October 23, 2015 18:42
factorial implementation in JS
var factorial = function (number) {
var n = 1;
while(number != 1) {
n = n * number;
number--;
}
return n;
};

Problem:

In the school you study, the recreation time is the most awaited time by most of the students. Not just because the classes sometimes are tiring, but because the lunch is very good.

When the recreation alarm sounds, all the students go out running from the class to arrive as early as possible in the canteen, such is the desire to eat. One of your teachers noticed that there was an opportunity there.

Using a reward system, your math teacher decided that the order in which the students will be served will not be given by the arrival time, but by the sum of grades obtained in class. In this way, those with higher grades can be served before those with lower grades.

Your task is simple: given the arrival time of the students in the canteen, and their respective grades in the math class, reorder the queue according to the math grades, and say how many students don't need to change place in this reordering.