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 | |
class PathManager | |
DEFAULT_DIRECTORY = '.' | |
attr_accessor :base_directory, :invalid_filenames | |
def initialize(args = {}) | |
self.base_directory = expand_path(args.fetch(:base_directory, DEFAULT_DIRECTORY)) | |
self.invalid_filenames = args[:invalid_filenames] |
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
import os | |
from github import Github | |
g = Github("token-goes-here") | |
org = g.get_organization("organization-name-goes-here") | |
repos = org.get_repos() | |
for repo in repos: | |
cmd = "git clone {}".format(repo.ssh_url) |
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
# frozen_string_literal: true | |
require_relative "../../../lib/thanoscase/string" | |
RSpec.describe "String class" do | |
it "should shorten an even string to half its size" do | |
expect("1234".thanoscase.length).to eq(2) | |
end | |
it "should shorten an odd string to half its size plus 1" 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
# frozen_string_literal: true | |
Gem::Specification.new do |s| | |
s.name = "thanoscase" | |
s.version = "0.0.1" | |
s.date = "2019-04-27" | |
s.summary = "Thanos gem" | |
s.description = "Randomly removes half the characters of a given string." | |
s.authors = ["Nicolas Sebastian Vidal"] | |
s.email = "[email protected]" |
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
source 'https://rubygems.org' | |
gemspec |
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
version: 2.1 | |
commands: | |
cached-bundle: | |
steps: | |
- restore_cache: | |
keys: | |
- gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} | |
- gem-cache-v1-{{ arch }}-{{ .Branch }} | |
- gem-cache-v1 | |
- run: bundle install --path vendor/bundle |
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
# frozen_string_literal: true | |
require "thanoscase/string" |
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
# frozen_string_literal: true | |
Gem::Specification.new do |s| | |
s.name = "thanoscase" | |
s.version = "0.0.1" | |
s.date = "2019-04-27" | |
s.summary = "Thanos gem" | |
s.description = "Randomly removes half the characters of a given string." | |
s.authors = ["Nicolas Sebastian Vidal"] | |
s.email = "[email protected]" |
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
# frozen_string_literal: true | |
class String | |
def thanoscase! | |
return self if empty? | |
half_universe = length/2 | |
half_universe.times { slice!(rand(length)) } | |
self | |
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
# coding: utf-8 | |
import BaseHTTPServer | |
HOST_NAME = 'localhost' | |
PORT = 8000 | |
def detectar_so(user_agent): | |
# Ver listados en http://www.useragentstring.com/pages/useragentstring.php | |
if 'Linux' in user_agent: |
NewerOlder