Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Nicolas Sebastian Vidal nisevi

🏠
Working from home
Block or report user

Report or block nisevi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nisevi
nisevi / string_spec.rb
Created May 3, 2019
Spec for covering the new methods
View string_spec.rb
# 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
@nisevi
nisevi / thanoscase.gemspec
Created May 3, 2019
Gemspec file with the addition of RSpec library
View thanoscase.gemspec
# 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 = "nicolas.s.vidal@gmail.com"
@nisevi
nisevi / Gemfile
Last active May 3, 2019
Gemfile for adding RSpec to our gem
View Gemfile
source 'https://rubygems.org'
gemspec
@nisevi
nisevi / config.yml
Created May 3, 2019
Basic RSpec coverage with CircleCI
View config.yml
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
@nisevi
nisevi / thanoscase.rb
Created May 1, 2019
File for importing the archives inside lib folder
View thanoscase.rb
# frozen_string_literal: true
require "thanoscase/string"
@nisevi
nisevi / thanoscase.gemspec
Last active May 3, 2019
Gemspec file, our interface to RubyGems
View thanoscase.gemspec
# 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 = "nicolas.s.vidal@gmail.com"
@nisevi
nisevi / string.rb
Created May 1, 2019
MonkeyPatch the String class for adding two new methods
View string.rb
# frozen_string_literal: true
class String
def thanoscase!
return self if empty?
half_universe = length/2
half_universe.times { slice!(rand(length)) }
self
end
@nisevi
nisevi / http3.py
Created Apr 30, 2019
TPL 5 - EJ14 - World Wide Web - HTTP
View http3.py
# 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:
@nisevi
nisevi / http1.py
Created Apr 30, 2019
TPL 5 - EJ12 - World Wide Web - HTTP
View http1.py
# coding: utf-8
import BaseHTTPServer
HOST_NAME = 'localhost'
PORT = 8000
class Handler(BaseHTTPServer.BaseHTTPRquestHandler):
def do_GET(server):
"""Respondo a una petición de tipo GET"""
@nisevi
nisevi / http2.py
Last active Apr 30, 2019
TPL 5 - EJ13 - World Wide Web - HTTP
View http2.py
# coding: utf-8
import BaseHTTPServer
HOST_NAME = 'localhost'
PORT = 8000
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(server):
You can’t perform that action at this time.