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
def is_prime(n): | |
if n == 2 or n == 3: return True | |
if n < 2 or n%2 == 0: return False | |
if n < 9: return True | |
if n%3 == 0: return False | |
r = int(n**0.5) | |
f = 5 | |
while f <= r: | |
#print('\t',f) | |
if n%f == 0: return False |
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
/* | |
* Base structure | |
*/ | |
/* Move down content because we have a fixed navbar that is 50px tall */ | |
body { | |
padding-top: 50px; | |
} | |
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
// Colocar no using | |
// using System.Net.Mail; | |
SmtpClient SmtpServer = new SmtpClient("smtp.live.com"); | |
var mail = new MailMessage(); | |
mail.From = new MailAddress("[email protected]"); | |
mail.To.Add("[email protected]"); | |
mail.Subject = "Test Mail - 1"; | |
mail.IsBodyHtml = true; | |
string htmlBody; |
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
<!-- Arquivo salvo em: views/sobre.html --> | |
<h2>Sobre</h2> | |
<p>Informações sobre o site...</p> | |
<p>Exemplo de variável: <$php echo $exemplo_variavel; ?></p></pre><br /> | |
No controller eu faço assim para chamar a view da página "Sobre" e o template:<br /> | |
<br /> |
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
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class C_administracao extends CI_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
} |
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
from time import time | |
start = time() | |
''' | |
Retorna true se o ano é bissexto e false se não for | |
''' | |
def is_leap_year(ano): | |
if (ano % 2 != 0): | |
return False | |
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
public static String getAlbum(String idAlbum) throws MalformedURLException, IOException{ | |
String CLIENT_ID = ""; | |
String Client_Secret = ""; | |
String YOUR_USERNAME = " "; // enter your imgur username | |
String YOUR_REQUEST_URL = "https://api.imgur.com/3/album/Y93oF"; | |
URL imgURL = new URL(YOUR_REQUEST_URL); | |
HttpURLConnection conn = (HttpURLConnection) imgURL.openConnection(); | |
conn.setRequestMethod("GET"); |
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
def fib_rec(n): | |
# essa é a condição que fará com que a função pare de chamar ela mesma | |
if n==1 or n==2: | |
return 1 # e retorne algum valor, que nos dois casos será 1 | |
# o retorno da função se não entrar no if que termina a recursão é ela chamar | |
# ela mesmo diminuindo o valor do parâmetro por 1 e depois por 2 e somar os resultados | |
# a função vai diminuindo o valor de n até que entre na função que para a recursão | |
return fib_rec(n-1) + fib_rec(n-2) |
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
Select l1.sid, | |
' esta bloqueando ' "Esta bloqueando", | |
l2.sid, | |
' matar esse => ' "Matar esse", | |
l1.sid, | |
l3.serial#, | |
'ALTER SYSTEM KILL SESSION '''|| l1.sid || ','|| l3.serial# ||'''' comando | |
From v$lock l1, | |
v$lock l2, | |
v$session l3 |
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 DataExtenso(Data:TDateTime): String; | |
var | |
NoDia : Integer; | |
DiaDaSemana : array [1..7] of String; | |
Meses : array [1..12] of String; | |
Dia, Mes, Ano : Word; | |
begin | |
DiaDasemana [1]:= 'Domingo'; | |
DiaDasemana [2]:= 'Segunda-feira'; | |
DiaDasemana [3]:= 'Terçafeira'; |
OlderNewer