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 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 | |
# 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
# 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<script> | |
document.onreadystatechange = () => { | |
if (document.readyState === 'complete') { |
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
# The aim of this class is to take a number of ordered enumerators and then | |
# create an Enumerator that emits their values in ascending order. | |
# | |
# Some assumptions: | |
# * The enumerators passed in emit their values in ascending order. | |
# * The enumerators emit values which are Comparable[1] with each other. | |
# * The enumerators can be finite *or* infinite. | |
# | |
# You can run the test suite with: `ruby combined_ordered_enumerator.rb`. | |
class CombinedOrderedEnumerator < Enumerator |
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
<?php | |
// [col size="foo-value"] | |
// Create the function that will handle the shortcode | |
function grid_column($attributes, $content = null) { | |
// shortcode_atts is used to define default attribute values | |
$attributes = shortcode_atts(array('size' => '12'), $attributes); | |
// keep applying shortcodes to content | |
$content = do_shortcode($content); |
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 | |
# Setup initial variables | |
number = Random.new | |
cpf = [] | |
vd1 = 0 | |
vd2 = 0 | |
# Generate the 9 first numbers | |
1.upto(9) do |i| |
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
<?php | |
class myStdClass { | |
public function __call($method, $args) { | |
if (isset($this->$method)) { | |
return call_user_func_array($this->$method, $args); | |
} | |
} | |
} |