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
# Create the Image ATL | |
image loop_bg: | |
"bg one" | |
time 1.0 | |
"bg two" | |
time 1.0 | |
repeat | |
# Add it as a background on screen window | |
# If you are using the default screen.rpy, there's probably a style |
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
#!/usr/bin/env ruby | |
# Given 2 sorted arrays with unique values and arbitrary size, count the | |
# intersection values between them | |
array_a = [1, 2, 4, 5, 7, 8] | |
array_b = [0, 1, 3, 4, 6, 7, 9] | |
index_a = index_b = count = 0 | |
loop do |
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
#! /usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
require 'tempfile' | |
download_list = Tempfile.new | |
CLIENT_ID = 'TWITCH_CLIENT_ID' | |
collection_id = ARGV.first.split('/').last | |
twitch_uri = URI("https://api.twitch.tv/kraken/collections/#{collection_id}/items") |
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
#! /usr/bin/env ruby | |
# ./worktime 10:12 [13:06] [14:15] [19:40] | |
now = Time.now | |
expected_work_time = 28800 | |
if ARGV[0].nil? | |
puts 'Você precisa fornecer ao menos o horário de entrada' | |
exit 1 |
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 Stat(object): | |
class Delta(object): | |
def __init__(self, parent): | |
self.parent = parent | |
self.value = parent.value | |
def __repr__(self): | |
return '<Stat.Delta value={}>'.format(self.calculate()) | |
def __str__(self): |
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
#! /usr/bin/env node | |
function validate_cpf(strCPF) { | |
if (new Set(strCPF).size == 1) return false | |
cpf = Array.from(strCPF).map(Number); | |
return [9, 10].every(pos => { | |
multiplier = pos + 1 |
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
#! /usr/bin/env ruby | |
# Write a function that returns true if the brackets in a given string are balanced. | |
# Balanced means that every parenthesis/bracket or brace that is opened must be closed | |
# And it must be closed in the right order (Always close the last symbol you opened) | |
# The function must handle parens (), square brackets [], and curly braces {}. | |
# "(a[0]+b[2c[6]]) {24 + 53}" should return true | |
# "f(e(d))" should return true | |
# "[()]{}([])" should return true |
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
#! /usr/bin/env ruby | |
require 'matrix' | |
# puts "▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟" | |
EMPTY = ' ' | |
BLOCK = '░' | |
BOX = '█' |
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
"WTF IS \033[30;47m???", a practical cheat-sheet | |
Font color definitions can be intimidating and nonsense at first, | |
but it is quite easy, lets just follow character by character: | |
┌────────┤\033├── Escape character (ESC) | |
│┌───────┤ [ ├── Define a sequence (many characters in a code) | |
││ | |
││┌──────┤ X ├── Parameter (optional) ┐ | |
│││┌─────┤ ; ├── Parameter separator │ SGR Code |
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
def beach(*temperature) | |
case temperature | |
in :celcius | :c, (20..45) | |
:favorable | |
in :kelvin | :k, (293..318) | |
:scientifically_favorable | |
in :fahrenheit | :f, (68..113) | |
:favorable_in_us | |
else | |
:avoid_beach |