This file contains 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
package br.com.tealdi.testing; | |
import java.text.Normalizer; | |
public class Hyphenator { | |
public String hyphenizeIt(String text) { | |
return trimmingHyphens( | |
removeNonCharactersButHyphen( | |
convertSpacesIntoHyphens( |
This file contains 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
var Calculator = (function () { | |
"use strict"; | |
function sum(firstNumber, secondNumber) { | |
return firstNumber + secondNumber; | |
} | |
return { | |
sum : sum | |
}; |
This file contains 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 WordGenerator | |
VOGALS = %w(a e i o u y) | |
CONSONANTS = [*?a..?z] - VOGALS | |
MOD_RESULT = [0, 1].freeze | |
def initialize(length) | |
@length = length | |
@mod_result = MOD_RESULT.sample | |
end |
This file contains 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
use strict; | |
use warnings; | |
use Directory::Queue::Simple; | |
my $dirq = Directory::Queue::Simple->new(path => "/tmp/test"); | |
my $done = 0; | |
for(my $name = $dirq->first(); $name; $name = $dirq->next()) { | |
next unless $dirq->lock($name); | |
my $data = $dirq->get($name); | |
printf("Body: \"%s\"\n", $data); |
This file contains 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
data = { | |
"amid" => ["em meio a", "no meio de", "entre"], | |
"bliss" => ["êxtase", "felicidade"], | |
"at first glance" => ["à primeira vista"], | |
"slumber" => ["dormir"], | |
"thrash out" => ["debater", "discutir"], | |
"plea" => ["apelo"], | |
"attire" => ["vestuário", "traje"], | |
"blunt" => ["brusco"], | |
"newlyweds" => ["recém-casados"], |
This file contains 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
clear; bundle outdated --strict 3>&1 1>&2 2>&3 | | |
grep '*' | | |
grep -v -E "(test|development)" | | |
awk '{ print $2 }' 3>&1 1>&2 2>&3 | | |
while read gem | |
do | |
echo -e "\nUpdating $gem...\n" | |
bundle update $gem | |
bundle exec rspec --fail-fast | |
test_exit_status=$? |
This file contains 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
# Usage: ruby -e "$(curl -s https://gist.githubusercontent.com/ricardotealdi/797f25e4020c5f8e8aff/raw/<HASH>/tictactoe.rb)" | |
board_add = -> (board, x, y, piece) { board[y][x] ? nil : board[y][x] = piece } | |
board_print = lambda do |board| | |
puts "" | |
puts ' 1 2 3' | |
board.each_with_index do |row, index| | |
format_row = row.map { |it| it.nil? ? ' ' : it.to_s.upcase }.join ' | ' | |
puts( |
This file contains 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
require 'influxdb' | |
require 'active_support/core_ext/hash/indifferent_access' | |
require 'active_support/core_ext/hash/deep_merge' | |
require 'yaml' | |
require 'thread' | |
class Registry | |
def initialize(options = {}) | |
@mutex = Mutex.new | |
@metrics = {} |