Skip to content

Instantly share code, notes, and snippets.

Avatar
🍤
Working on Potigol Language (potigol.github.io)

Leonardo Lucena lrlucena

🍤
Working on Potigol Language (potigol.github.io)
View GitHub Profile
View curso.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr bgcolor="#9acd32">
<th>Curso</th>
<th>Modalidade / Campus</th>
@lrlucena
lrlucena / Q01.rb
Last active Oct 7, 2015
Resposta da Lista de Exercícios 11
View Q01.rb
def lerInt(n)
n.times.map do
gets.to_i
end
end
vetor1 = lerInt(3)
vetor2 = lerInt(4)
vetor3 = vetor1 + vetor2
print vetor3
@lrlucena
lrlucena / Dado.rb
Created Jul 13, 2012
Aula de Classes e Objetos
View Dado.rb
class Dado
def rolar
return 1 + rand(6)
end
end
@lrlucena
lrlucena / Q01.rb
Last active Oct 7, 2015
Gabarito da Lista de Exercícios 12
View Q01.rb
# Escreva uma classe, chamada Ponto, que representa um ponto no
# plano cartesiano. A figura abaixo mostra quais atributos e métodos
# da classe.
class Ponto
attr_reader :x, :y
def initialize(x,y)
@x = x
@y = y
View bomba.rb
class Bomba
attr_reader :x, :y, :ativa
def initialize(janela)
@janela = janela
@icon = Gosu::Image.new(@janela, 'bomba.png', true)
@y = -rand(200)
@x = rand(@janela.width-60)
@ativa = true
end
def update(laser)
@lrlucena
lrlucena / Map.scala
Created Nov 12, 2012
Scala Dojo - ThoughtWorks
View Map.scala
package main.scala
import math.{ abs, min }
import Int.MaxValue
case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) {
def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds)
def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate)
@lrlucena
lrlucena / Map.scala
Created Nov 12, 2012
Scala Dojo - ThoughtWorks
View Map.scala
package main.scala
import math.{ abs, min }
import Int.MaxValue
case class Map(val airports: Seq[(Int, Int)] = Seq(), val clouds: Seq[(Int, Int)] = Seq()) {
def addAirports(coordinates: Seq[(Int, Int)]) = Map(airports ++ coordinates, clouds)
def airportAt(coordinate: (Int, Int)) = airports.exists(_ == coordinate)
View Exercicios01.rb
# Questao 1
"Programacao de Computadores".size
# ou
"Programacao de Computadores".length
# Questao 2
media = (8.12 + 7.45) / 2.0
"A sua media foi de "+ media.to_s + " este ano!"
# ou como será visto mais adiante ...
View ServidorHttp.java
import java.io.*;
import java.net.*;
public class ServidorHttp {
public static void main(String args[]) {
ServerSocket s = null;
try {
s = new ServerSocket(7896);
// right now the stream is open.
while (true) {