This file contains hidden or 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
| public class Bit{ | |
| public static int parseInt(String bits){ | |
| String bitInput = bits; | |
| int bitLength = bits.length(); | |
| int bitList[] = new int[bitLength]; | |
| int base2 = 0; | |
| StringBuffer buffer = new StringBuffer(bitInput); |
This file contains hidden or 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 get(type, term, max){ | |
| if(!type){ | |
| console.info('HOW TO USE:\nArg 1 (String type): id | class | tag | query | query all\nArg 2 (String term): the search term\nArg 3 (Number|String max): maximum number of elements, if required (for NodeList or HTMLCollection)'); | |
| }else{ | |
| if(type=='id'){ | |
| return document.getElementById(term); | |
| }else if(type=='class'){ | |
| if(!max){ | |
| return document.getElementsByClassName(term); | |
| }else{ |
This file contains hidden or 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
| //Pacote "src". | |
| package src; | |
| // Herda tudo da classe Pessoa | |
| public class Fisica extends Pessoa{ | |
| // Atributos privados. | |
| private String cpf; | |
| // Alterar cpf | |
| public void setCpf(String cpfInserido){ |
This file contains hidden or 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
| var alfa = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]; | |
| var frase = prompt("Digite a frase:").toLowerCase(); | |
| var x = parseInt(prompt("Digite o número do deslocamento:")); | |
| var fraseCifra = []; | |
| for (var i = 0; i < frase.length; i++){ | |
| if(frase[i] != ' '){ | |
| for (var j = 0; j < alfa.length; j++){ | |
| if (frase[i] == alfa[j]){ | |
| fraseCifra[i] = alfa[(j + x) % alfa.length]; |
This file contains hidden or 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
| # É necessário um bloco init para criar as variáveis antes de inicializar o resto | |
| init python: | |
| # variáveis globais, serão alteradas dinamicamente | |
| vidaPlayer = 100 | |
| vidaMaxima = 100 | |
| # Criando uma tela (screen) -> uma screen pode ser criada em qualquer lugar, inclusive no arquivo screens.rpy | |
| # Telas são layers do jogo que podem ser exibidas acima do layer principal | |
| # Screens suportam argumentos, como em um método, no caso você pode passar informações quando exibir essa tela. | |
| screen barraDeVida(tamanhoDaBarra=100): |
This file contains hidden or 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
| var points = document.querySelector(".kno-ecr-pt.kno-fb-ctx"), | |
| mario = document.getElementById("kno-mcbeeq"), | |
| coins = document.querySelector("span.kno-fb-ctx"), | |
| score = 0, | |
| inc = 1; | |
| mario.onclick = function(){ | |
| score += 200; | |
| points.innerHTML = score; | |
| coins.innerHTML = inc++; | |
| }; |
This file contains hidden or 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
| # -*- coding: UTF-8 -*- | |
| import random | |
| robotNumber = random.randint(1,100) | |
| tentativas = 1 | |
| yourNumber = "" | |
| #print robotNumber | |
| print u"\n Estou pensando em um número entre 1 e 100!\n Tente advinhar qual é!" |
This file contains hidden or 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
| # -*- coding: UTF-8 -*- | |
| import random | |
| robotNumber = random.randint(1,100) | |
| tentativas = 1 | |
| yourNumber = "" | |
| #print robotNumber | |
| print u"\n Estou pensando em um número entre 1 e 100!\n Tente advinhar qual é!" |
This file contains hidden or 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
| # -*- coding: UTF-8 -*- | |
| import random | |
| robotNumber = random.randint(1,100) | |
| tentativas = 1 | |
| #print robotNumber | |
| print u"\n Estou pensando em um número entre 1 e 100!\n Tente advinhar qual é!" |
This file contains hidden or 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
| # -*- coding: UTF-8 -*- | |
| import random | |
| print u"= Jogo do par ou ímpar =\n" | |
| print u" Digite a sua escolha:\n 1 para ímpar\n 2 para par" | |
| suaEscolha = raw_input("> ") | |
| print u" Digite o seu número (de zero até 5):" | |
| seuNumero = int(raw_input("> ")) |