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
defmodule Solution do | |
defp sum(a, b), do: a + b | |
def main() do | |
a = IO.gets("") |> String.strip |> String.to_integer | |
range = 1..a | |
Enum.reduce(range, 0, fn(x, acc) -> sum(acc, IO.gets("") |> String.strip |> String.to_integer) end) | |
|> IO.puts | |
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
#!/bin/sh | |
# Parts of this file come from: | |
# http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Create_clj_Script | |
BREAK_CHARS="\(\){}[],^%$#@\"\";:''|\\" | |
CLOJURE_DIR=/usr/local/lib/clojure | |
CLOJURE_JAR=$CLOJURE_DIR/clojure.jar | |
CLASSPATH="$CLOJURE_DIR/*:$CLOJURE_JAR" | |
while [ $# -gt 0 ] |
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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>Some Random Page</title> | |
<style> | |
body { | |
border: 1px solid black; | |
background: white; | |
} | |
p { |
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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>Some Random Page</title> | |
<link href="style.css" rel="stylesheet"> | |
<script src="jquery.js" async></script> | |
</head> | |
<body> | |
<div><img src="polemic-photo.jpg"></div> |
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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>Some Random Page</title> | |
<link href="style.css" rel="stylesheet"> | |
<script src="jquery.js"></script> | |
</head> | |
<body> | |
<div><img src="polemic-photo.jpg"></div> | |
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
/* reset */ | |
* { | |
padding: 0; | |
margin: 0; | |
border: 0; | |
outline: 0; | |
font-size: 100%; | |
line-height: 1em; | |
list-style: none; | |
text-decoration: none; |
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
function createShaders(gl) { | |
var vertexShaderSrc = String(); // fill it with shader string or Script Text | |
var vertexShader = gl.createShader(gl.VERTEX_SHADER); | |
gl.shaderSource(vertexShader, vertexShaderSrc); | |
gl.compileShader(vertexShader); | |
var success = gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS); | |
if (!success) { | |
throw "could not compile shader:" + gl.getShaderInfoLog(vertexShader); | |
} |
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
// From QUnit.js | |
function objectType( obj ) { | |
if ( typeof obj === "undefined" ) { | |
return "undefined"; | |
} | |
// Consider: typeof null === object | |
if ( obj === null ) { | |
return "null"; | |
} |
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
// using bluebird | |
var Servico = { | |
listarUsuarios: function(callback) { | |
setTimeout(function(){ callback(null, [{nome:"Gabriel"}, {nome:"Raphael"}]) }, 100); | |
}, | |
listarFavoritos: function(usuario, callback) { | |
if (usuario.nome === "Gabriel") { | |
setTimeout(function(){ callback(null, ["http://www.google.com.br"]) }, Math.random() * 100); |
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/python | |
import numpy as np | |
print "1 = Faca um algoritmo que troque o valor de duas variaveis. Por exemplo, o algoritmo le n1 igual a 3 e n2 a 17, e mostra n1 igual a 17 e n2 a 3." | |
print "2 = Faca um algoritmo para calcular a media de duas notas digitadas pelo usuario." | |
print "3 = Faca um algoritmo que calcule a area de um quadrado, sendo que o comprimento do lado e informado pelo usuario. A area do quadrado e calculada elevando-se o lado ao quadrado." | |
exerc = int(raw_input("Defina qual o numero do exercicio: ")) | |
if exerc == 1: |
NewerOlder