Skip to content

Instantly share code, notes, and snippets.

View therod's full-sized avatar

Rodrigo therod

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Portfolio</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.0/css/foundation.min.css">
<link rel="stylesheet" href="/base.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="row">
<div class="small-12 columns">
<ul class="menu">
<li><a href="#">Navigation 1</a></li>
<li><a href="#">Navigation 2</a></li>
<li><a href="#">Navigation 3</a></li>
</ul>
</div>
</div>
@therod
therod / ex1.rb
Created January 20, 2017 08:33
exercise_1.rb
# This is just a simple example on how to use puts
puts "Hello World!"
puts "This is fun!"
puts "Yahooo! Printing."
puts "I'd much rather you 'not'."
puts 'I "said" do not touch this.'
puts "This is a string interpolation test #{1 + 1}"
# We require the minitest library
require 'minitest/autorun'
# CLASS DEFINITION
class Person
attr_accessor :age, :name
def say(name)
"Hi, my name is test blablabla #{name}"
end
# We require the unit testing module of Ruby
require 'minitest/autorun'
# # Class Definition
class Person
def say(name)
"Hello, my name is #{name} World"
end
end
@therod
therod / podesta.rb
Last active January 18, 2017 09:19
require 'curb'
count = 0
while count
puts "Getting E-Mail #{count}"
email = Curl::Easy.perform("https://www.wikileaks.org/podesta-emails/get/#{count}")
if email.body_str.include?('<h1>Internal Server Error</h1>')
puts "Reached final e-mail"
@therod
therod / crop.rb
Created November 3, 2016 23:24
Crop images from a folder using resize_to_fill and create two different Gravity Versions
require 'pry'
require 'rmagick'
require 'pathname'
require 'rake/pathmap'
include Magick
Dir.glob('./authors/*.jpg').map do |file|
pn = Pathname.new(file)
out_file = "./cropped/#{pn.basename}"
@therod
therod / rename.rb
Created November 3, 2016 18:36
Simple script that normalizes files in a folder and renames them accordingly
require 'i18n'
require 'fileutils'
I18n.available_locales = [:en]
Dir.glob('./authors/*.jpg').map do |orig|
dest = I18n.transliterate(orig.downcase.tr(' ', '-').tr('_', '-'))
File.rename(orig, dest)
end
@therod
therod / shillary.rb
Last active January 18, 2017 09:15
Automatically download the latest Podesta E-Mails from Wikileaks
#!/usr/bin/env ruby
require 'typhoeus'
Dir.mkdir('mail') unless Dir.exist?('mail')
def last_email
Dir.entries('mail').last.scan(/\d/).join('').sub!(/^0+/, '').to_i
end
def write_email(id, body)
require 'pry'
# 1 - First we define the Car class
class Car
end
# 2 - Every class needs a so called initializer method
class Car
def initialize
end