This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Algoritmo de Logaritmo | |
# Autor: Gabriel "Gab!" Teles <gab dot teles at hotmail dot com> | |
# Data: 2013-04-26 | |
def log(n, m) | |
# Verifica valores de entrada | |
if m == 0 # Não existe logaritmo de 0, logo, adequa valor | |
# ao retornado pelo Math.log: -Infinity | |
return -1.0/0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class << Math | |
# Checa se um número é primo ou não. | |
# | |
# value - Valor que deverá ser checado | |
# checksByThread - Quantidade de checagens por thread. | |
# Ajuda a driblar o processamento com valores menores | |
# Ajuda a driblar a utilização de recursos com valores maiores | |
# | |
def isPrime?(value, checksByThread = 10**10) | |
# Rotina para checagem de número primos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interpretador de Brainfuck V2 | |
# Autor: Gabriel Teles <[email protected]> | |
require 'io/console' # Necessário para usar STDIN.getch | |
module Brainfuck2 | |
# Classe de controle | |
class ProgramData | |
attr_reader :bufferSize, :buffer, :stack, :commands, :position | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Konami Code jQuery Plugin | |
* | |
* Usage: | |
* | |
* 1 - Set permanent callback: everytime the user makes the | |
* konami code the callback will | |
* be called. | |
* | |
* $(document).konamiCode(callback, true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# @file : Main.rb | |
# @desc : Omni RGSSx Player | |
# @author : Gab! | |
# @history : 2014/04/04 | |
# Requires | |
require 'fiddle' | |
require 'fiddle/struct' | |
require 'fiddle/types' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def cfor(init, condition, inc) | |
while condition.() | |
yield | |
inc.() | |
end | |
end | |
end | |
if ($0 == __FILE__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def combsort!(shrink = 1.247330950103979) | |
gap = size | |
swapped = false | |
until gap == 1 and !swapped | |
gap = (gap / shrink).to_i | |
gap = 1 if gap < 1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implementação pela fórmula | |
class << Math | |
FiveSquareRoot = Math.sqrt(5) | |
GoldenRatio = (1 + FiveSquareRoot) / 2 | |
def fibonacci(n) | |
((GoldenRatio ** n - ((-GoldenRatio) ** (-n))) / FiveSquareRoot).round | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filters sensitive data from Angular's $http responses. | |
* | |
* @author Gabriel Teles <[email protected]> | |
* @version 0.1.0 | |
* @since 2015.12.10 | |
*/ | |
(function() { | |
'use strict'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time terraform apply -var-file=terraform-private.tfvars -var-file=terraform.tfvars | |
... | |
real 3m35,256s | |
user 0m3,221s | |
sys 0m1,241s | |
$ time terraform destroy -var-file=terraform-private.tfvars -var-file=terraform.tfvars | |
real 4m25,263s | |
user 0m3,484s | |
sys 0m1,152s |
OlderNewer