Skip to content

Instantly share code, notes, and snippets.

View abevieiramota's full-sized avatar
🎯
Focusing

Abelardo Vieira Mota abevieiramota

🎯
Focusing
View GitHub Profile
// [Traits, ]
trait Iterator[A] {
def hasNext: Boolean
def next(): A
}
class IntIterator(to: Int) extends Iterator[Int] {
private var current = 0
override def hasNext: Boolean = current < to
// [Basics, Classes]
var x = 1
x += 1
val y = 10
val addTwo = (x: Int) => x + 2
val sum = (x: Int, y: Int) => x + y
val returnFive = () => 5
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abevieiramota
abevieiramota / pep20_by_example.py
Created May 18, 2017 20:32 — forked from evandrix/pep20_by_example.py
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, [email protected] / [email protected]
from bs4 import BeautifulSoup
import urllib.request
page = urllib.request.urlopen("http://wewilltakeyouwithepica.blogspot.com.br/p/por-tras-das-letras.html")
html = page.read().decode("utf-8")
bs = BeautifulSoup(html, "lxml")
texto_do_site = bs.text
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.